[cfe-commits] r90438 - /cfe/trunk/lib/Frontend/PCHWriterDecl.cpp

Daniel Dunbar daniel at zuster.org
Thu Dec 3 01:13:37 PST 2009


Author: ddunbar
Date: Thu Dec  3 03:13:36 2009
New Revision: 90438

URL: http://llvm.org/viewvc/llvm-project?rev=90438&view=rev
Log:
Use llvm_report_error instead of fprintf + assert + exit.

Modified:
    cfe/trunk/lib/Frontend/PCHWriterDecl.cpp

Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=90438&r1=90437&r2=90438&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Thu Dec  3 03:13:36 2009
@@ -14,9 +14,9 @@
 #include "clang/Frontend/PCHWriter.h"
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/Expr.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Bitcode/BitstreamWriter.h"
-#include <cstdio>
-
+#include "llvm/Support/ErrorHandling.h"
 using namespace clang;
 
 //===----------------------------------------------------------------------===//
@@ -568,12 +568,9 @@
   W.Visit(D);
   if (DC) W.VisitDeclContext(DC, LexicalOffset, VisibleOffset);
 
-  if (!W.Code) {
-    fprintf(stderr, "Cannot serialize declaration of kind %s\n",
-            D->getDeclKindName());
-    assert(false && "Unhandled declaration kind while generating PCH");
-    exit(-1);
-  }
+  if (!W.Code)
+    llvm::llvm_report_error(llvm::StringRef("unexpected declaration kind '") +
+                            D->getDeclKindName() + "'");
   Stream.EmitRecord(W.Code, Record, W.AbbrevToUse);
 
   // If the declaration had any attributes, write them now.





More information about the cfe-commits mailing list