Use llvm_report_error instead of fprintf + assert + exit.

llvm-svn: 90438
This commit is contained in:
Daniel Dunbar 2009-12-03 09:13:36 +00:00
parent 7554699afa
commit f5bda7b5eb
1 changed files with 5 additions and 8 deletions

View File

@ -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 @@ void PCHWriter::WriteDecl(ASTContext &Context, Decl *D) {
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.