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 | 36e3b5c79e2a8d40160aed27f8197793d74fbcc0 (patch) | |
tree | 297eb7adcfc32262afee8285e47cd67eaed7be27 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 72b91c1765a1f9bcaa5ffe7cdfe2a0e7f46577fe (diff) | |
download | bcm5719-llvm-36e3b5c79e2a8d40160aed27f8197793d74fbcc0.tar.gz bcm5719-llvm-36e3b5c79e2a8d40160aed27f8197793d74fbcc0.zip |
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
llvm-svn: 116241
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index c2037a38ca9..bf66b854735 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/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); |