aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Lex/CodeCompletionHandler.h7
-rw-r--r--include/clang/Lex/Preprocessor.h5
-rw-r--r--include/clang/Parse/Parser.h1
-rw-r--r--include/clang/Sema/Action.h11
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h7
-rw-r--r--include/clang/Sema/Sema.h1
6 files changed, 31 insertions, 1 deletions
diff --git a/include/clang/Lex/CodeCompletionHandler.h b/include/clang/Lex/CodeCompletionHandler.h
index 4cc3b12d47..ee02a227e6 100644
--- a/include/clang/Lex/CodeCompletionHandler.h
+++ b/include/clang/Lex/CodeCompletionHandler.h
@@ -35,6 +35,13 @@ public:
/// \brief Callback invoked when performing code completion within a block of
/// code that was excluded due to preprocessor conditionals.
virtual void CodeCompleteInConditionalExclusion() { }
+
+ /// \brief Callback invoked when performing code completion in a context
+ /// where the name of a macro is expected.
+ ///
+ /// \param IsDefinition Whether this is the definition of a macro, e.g.,
+ /// in a #define.
+ virtual void CodeCompleteMacroName(bool IsDefinition) { }
};
}
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 712feaa425..543cb74226 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -382,6 +382,11 @@ public:
CodeComplete = &Handler;
}
+ /// \brief Retrieve the current code-completion handler.
+ CodeCompletionHandler *getCodeCompletionHandler() const {
+ return CodeComplete;
+ }
+
/// \brief Clear out the code completion handler.
void clearCodeCompletionHandler() {
CodeComplete = 0;
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 83b42fd172..e485963026 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -1535,6 +1535,7 @@ private:
// Preprocessor code-completion pass-through
virtual void CodeCompleteDirective(bool InConditional);
virtual void CodeCompleteInConditionalExclusion();
+ virtual void CodeCompleteMacroName(bool IsDefinition);
};
} // end namespace clang
diff --git a/include/clang/Sema/Action.h b/include/clang/Sema/Action.h
index d407037515..aebb2b4d2b 100644
--- a/include/clang/Sema/Action.h
+++ b/include/clang/Sema/Action.h
@@ -3215,6 +3215,17 @@ public:
/// \brief Code completion while in an area of the translation unit that was
/// excluded due to preprocessor conditionals.
virtual void CodeCompleteInPreprocessorConditionalExclusion(Scope *S) { }
+
+ /// \brief Code completion in the preprocessor where an already-defined
+ /// macro name is expected, e.g., an #ifdef or #undef.
+ ///
+ /// \param S The scope in which the macro name occurs.
+ ///
+ /// \param IsDefinition Whether this code completion for a macro name occurs
+ /// in a definition of the macro (#define) or in another use that already
+ /// expects that the macro is defined (e.g., #undef or #ifdef).
+ virtual void CodeCompletePreprocessorMacroName(Scope *S, bool IsDefinition) {
+ }
//@}
};
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index 59d8a4fd04..f9cf484953 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -169,7 +169,12 @@ public:
CCC_Name,
/// \brief Code completion occurred where a new name is expected and a
/// qualified name is permissible.
- CCC_PotentiallyQualifiedName
+ CCC_PotentiallyQualifiedName,
+ /// \brief Code completion occurred where an macro is being defined.
+ CCC_MacroName,
+ /// \brief Code completion occurred where a macro name is expected
+ /// (without any arguments, in the case of a function-like macro).
+ CCC_MacroNameUse
};
private:
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index b4449ff45c..1ad6ca690a 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -4692,6 +4692,7 @@ public:
unsigned NumSelIdents);
virtual void CodeCompletePreprocessorDirective(Scope *S, bool InConditional);
virtual void CodeCompleteInPreprocessorConditionalExclusion(Scope *S);
+ virtual void CodeCompletePreprocessorMacroName(Scope *S, bool IsDefinition);
void GatherGlobalCodeCompletions(
llvm::SmallVectorImpl<CodeCompleteConsumer::Result> &Results);
//@}