From: Ted Kremenek Date: Fri, 5 Feb 2010 21:28:51 +0000 (+0000) Subject: Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e50187a987dadb6a3b6f673125617c8f42ff3560;p=clang Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do anything when Sema has issued an error. This matches the behavior in RewriteObjC::HandleTranslationUnit(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95434 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index b90babda5c..d1b098af61 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/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;