[cfe-commits] r92809 - /cfe/trunk/lib/Sema/SemaLookup.cpp

Ted Kremenek kremenek at apple.com
Tue Jan 5 16:23:05 PST 2010

Author: kremenek
Date: Tue Jan  5 18:23:04 2010
New Revision: 92809

URL: http://llvm.org/viewvc/llvm-project?rev=92809&view=rev
Per offline discussion with Doug, don't perform typo correction when we have encountered a fatal error.  On some files that are woefully wrong (missing headers) this can cause a 3x slowdown in some cases when parsing the file.  It makes sense not to perform typo correction in this case because after a fatal error diagnostics will either be suppressed or not really make any sense.


Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=92809&r1=92808&r2=92809&view=diff

--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Jan  5 18:23:04 2010
@@ -2199,6 +2199,10 @@
 bool Sema::CorrectTypo(LookupResult &Res, Scope *S, const CXXScopeSpec *SS,
                        DeclContext *MemberContext, bool EnteringContext,
                        const ObjCObjectPointerType *OPT) {
+  if (Diags.hasFatalErrorOccurred())
+    return false;
   // We only attempt to correct typos for identifiers.
   IdentifierInfo *Typo = Res.getLookupName().getAsIdentifierInfo();
   if (!Typo)

More information about the cfe-commits mailing list