From 1dac3418f43c132df0b836a2f514f82a44189ef9 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 6 Jan 2010 00:23:04 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92809 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaLookup.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 1f2943cb1f..9ed15225b4 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -2199,6 +2199,10 @@ void TypoCorrectionConsumer::FoundDecl(NamedDecl *ND, NamedDecl *Hiding) { 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) -- 2.40.0