From 31e7f0f2937f0ae9faf35b4158b2efd4fb0b458b Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 5 Feb 2010 21:28:51 +0000 Subject: Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do anything when Sema has issued an error. This matches the behavior in RewriteObjC::HandleTranslationUnit(). llvm-svn: 95434 --- clang/lib/Frontend/RewriteObjC.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'clang/lib/Frontend/RewriteObjC.cpp') diff --git a/clang/lib/Frontend/RewriteObjC.cpp b/clang/lib/Frontend/RewriteObjC.cpp index b90babda5c5..d1b098af616 100644 --- a/clang/lib/Frontend/RewriteObjC.cpp +++ b/clang/lib/Frontend/RewriteObjC.cpp @@ -634,6 +634,9 @@ void RewriteObjC::Initialize(ASTContext &context) { //===----------------------------------------------------------------------===// void RewriteObjC::HandleTopLevelSingleDecl(Decl *D) { + if (Diags.hasErrorOccurred()) + return; + // Two cases: either the decl could be in the main file, or it could be in a // #included file. If the former, rewrite it now. If the later, check to see // if we rewrote the #include/#import. @@ -5248,11 +5251,6 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { } void RewriteObjC::HandleTranslationUnit(ASTContext &C) { - // Get the top-level buffer that this corresponds to. - - // Rewrite tabs if we care. - //RewriteTabs(); - if (Diags.hasErrorOccurred()) return; -- cgit v1.2.3