aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-24 19:08:16 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-24 19:08:16 +0000
commitf44e854ed1e3aa86d2ed6d615ccd109d50ddcff9 (patch)
treeb3fd57ca42856df16b30ce95b7030b5a4e10123c /lib/Parse/Parser.cpp
parentcdaa6a8fed16d8bd3987fb4f3304dfb4e52876c3 (diff)
Introduce basic code-completion support for preprocessor directives,
e.g., after a "#" we'll suggest #if, #ifdef, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 8fd1e48994..230506d85f 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -50,6 +50,8 @@ Parser::Parser(Preprocessor &pp, Action &actions)
WeakHandler.reset(new PragmaWeakHandler(actions));
PP.AddPragmaHandler(WeakHandler.get());
+
+ PP.setCodeCompletionHandler(*this);
}
/// If a crash happens while the parser is active, print out a line indicating
@@ -316,6 +318,7 @@ Parser::~Parser() {
UnusedHandler.reset();
PP.RemovePragmaHandler(WeakHandler.get());
WeakHandler.reset();
+ PP.clearCodeCompletionHandler();
}
/// Initialize - Warm up the parser.
@@ -1126,3 +1129,13 @@ void Parser::CodeCompletionRecovery() {
// performance-sensitive.
void Parser::FieldCallback::_anchor() {
}
+
+// Code-completion pass-through functions
+
+void Parser::CodeCompleteDirective(bool InConditional) {
+ Actions.CodeCompletePreprocessorDirective(getCurScope(), InConditional);
+}
+
+void Parser::CodeCompleteInConditionalExclusion() {
+ Actions.CodeCompleteInPreprocessorConditionalExclusion(getCurScope());
+}