diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-25 05:58:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-25 05:58:43 +0000 |
commit | dc8453422bec3bbf70c03920e01498d75783d122 (patch) | |
tree | d5b85f0cac85117aee6dba355777536efdb8022f /lib/Sema/SemaCodeComplete.cpp | |
parent | ab28099e3bd4859585ccb316f9f571c8c6b035fd (diff) |
Improve code completion in failure cases in two ways:
1) Suppress diagnostics as soon as we form the code-completion
token, so we don't get any error/warning spew from the early
end-of-file.
2) If we consume a code-completion token when we weren't expecting
one, go into a code-completion recovery path that produces the best
results it can based on the context that the parser is in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 036ae7e869..1685cd572e 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -843,6 +843,7 @@ static void AddFunctionSpecifiers(Action::CodeCompletionContext CCC, case Action::CCC_Statement: case Action::CCC_ForInit: case Action::CCC_Condition: + case Action::CCC_RecoveryInFunction: break; } } @@ -994,6 +995,7 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC, AddObjCVisibilityResults(SemaRef.getLangOptions(), Results, true); break; + case Action::CCC_RecoveryInFunction: case Action::CCC_Statement: { Results.AddResult(Result("typedef")); @@ -1925,6 +1927,10 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case CCC_Condition: Results.setFilter(&ResultBuilder::IsOrdinaryName); break; + + case CCC_RecoveryInFunction: + // Unfiltered + break; } CodeCompletionDeclConsumer Consumer(Results, CurContext); @@ -3079,8 +3085,6 @@ void Sema::CodeCompleteObjCClassMessage(Scope *S, TypeTy *Receiver, } Results.ExitScope(); - - // This also suppresses remaining diagnostics. HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size()); } |