aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-06 00:23:04 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-06 00:23:04 +0000
commit1dac3418f43c132df0b836a2f514f82a44189ef9 (patch)
tree58e46cc6df04cce2b4d62fd530256c38e375eed7 /lib/Sema/SemaLookup.cpp
parent02deae8f9bb2cbd177816cd6b4b10129461980f7 (diff)
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
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp4
1 files changed, 4 insertions, 0 deletions
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)