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.
llvm-svn: 92809
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 1f2943c..9ed1522 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -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)