diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-11 21:37:58 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-11 21:37:58 +0000 |
commit | 32be4a588fbb87d0d163ead49c42f5438bf0b2b7 (patch) | |
tree | b419e2312a2d3b96d6476b6baade5f9b034df02c /lib/Frontend/ASTUnit.cpp | |
parent | f2ad2c92720f0e25c032188783a1d6374155f03a (diff) |
Switch c-index-test from clang_codeComplete() over to
clang_codeCompleteAt(). This uncovered a few issues with the latter:
- ASTUnit wasn't saving/restoring diagnostic state appropriately between
reparses and code completions.
- "Overload" completions weren't being passed through to the client
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index c2037a38ca..bf66b85473 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -25,6 +25,7 @@ #include "clang/Frontend/FrontendActions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/FrontendOptions.h" +#include "clang/Frontend/Utils.h" #include "clang/Serialization/ASTReader.h" #include "clang/Serialization/ASTWriter.h" #include "clang/Lex/HeaderSearch.h" @@ -1058,7 +1059,11 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( // Set the state of the diagnostic object to mimic its state // after parsing the preamble. + // FIXME: This won't catch any #pragma push warning changes that + // have occurred in the preamble. getDiagnostics().Reset(); + ProcessWarningOptions(getDiagnostics(), + PreambleInvocation.getDiagnosticOpts()); getDiagnostics().setNumWarnings(NumWarningsInPreamble); if (StoredDiagnostics.size() > NumStoredDiagnosticsInPreamble) StoredDiagnostics.erase( @@ -1195,6 +1200,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( // Clear out old caches and data. getDiagnostics().Reset(); + ProcessWarningOptions(getDiagnostics(), Clang.getDiagnosticOpts()); StoredDiagnostics.clear(); TopLevelDecls.clear(); TopLevelDeclsInPreamble.clear(); @@ -1463,8 +1469,10 @@ bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) { OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(*Invocation); // Clear out the diagnostics state. - if (!OverrideMainBuffer) + if (!OverrideMainBuffer) { getDiagnostics().Reset(); + ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts()); + } // Parse the sources bool Result = Parse(OverrideMainBuffer); @@ -1757,6 +1765,7 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, // Set up diagnostics, capturing any diagnostics produced. Clang.setDiagnostics(&Diag); + ProcessWarningOptions(Diag, CCInvocation.getDiagnosticOpts()); CaptureDroppedDiagnostics Capture(true, Clang.getDiagnostics(), StoredDiagnostics); |