summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-15 06:18:01 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-15 06:18:01 +0000
commit3998219789710036ed565853047c308c47215e61 (patch)
treebb5a38ffc1ceae6a633830dae8215a7acd466379 /clang/lib/Frontend/CompilerInstance.cpp
parentf8d9817f4b8496dd109324ba136fb6cac7ab74dd (diff)
downloadbcm5719-llvm-3998219789710036ed565853047c308c47215e61.tar.gz
bcm5719-llvm-3998219789710036ed565853047c308c47215e61.zip
Extend the code-completion caching infrastructure to include global
declarations (in addition to macros). Each kind of declaration maps to a certain set of completion contexts, and the ASTUnit completion logic introduces the completion strings for those declarations if the actual code-completion occurs in one of the contexts where it matters. There are a few new code-completion-context kinds. Without these, certain completions (e.g., after "using namespace") would need to suppress all global completions, which would be unfortunate. Note that we don't get the priorities right for global completions, because we don't have enough type information. We'll need a way to compare types in an ASTContext-agnostic way before this can be implemented. llvm-svn: 111093
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 06ec80589c7..8e1dbcb9d24 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -328,6 +328,7 @@ void CompilerInstance::createCodeCompletionConsumer() {
getFrontendOpts().DebugCodeCompletionPrinter,
getFrontendOpts().ShowMacrosInCodeCompletion,
getFrontendOpts().ShowCodePatternsInCodeCompletion,
+ getFrontendOpts().ShowGlobalSymbolsInCodeCompletion,
llvm::outs()));
if (!CompletionConsumer)
return;
@@ -356,15 +357,18 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
bool UseDebugPrinter,
bool ShowMacros,
bool ShowCodePatterns,
+ bool ShowGlobals,
llvm::raw_ostream &OS) {
if (EnableCodeCompletion(PP, Filename, Line, Column))
return 0;
// Set up the creation routine for code-completion.
if (UseDebugPrinter)
- return new PrintingCodeCompleteConsumer(ShowMacros, ShowCodePatterns, OS);
+ return new PrintingCodeCompleteConsumer(ShowMacros, ShowCodePatterns,
+ ShowGlobals, OS);
else
- return new CIndexCodeCompleteConsumer(ShowMacros, ShowCodePatterns, OS);
+ return new CIndexCodeCompleteConsumer(ShowMacros, ShowCodePatterns,
+ ShowGlobals, OS);
}
void CompilerInstance::createSema(bool CompleteTranslationUnit,
OpenPOWER on IntegriCloud