summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-24 20:21:13 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-24 20:21:13 +0000
commit127851084d42e79e930a7cceca4eec02afd482f7 (patch)
tree941c0eac261b433785b36dc942d8c5b8aacbdf96 /clang/lib/Lex/PPDirectives.cpp
parent3aeedd1e5a8dd198589fbd45eac015f1317a8d72 (diff)
downloadbcm5719-llvm-127851084d42e79e930a7cceca4eec02afd482f7.tar.gz
bcm5719-llvm-127851084d42e79e930a7cceca4eec02afd482f7.zip
Implement preprocessor code completion where a macro name is expected,
e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname> expression in a preprocessor conditional. llvm-svn: 111954
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index e0729f123f0..8da7def9ed4 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -75,6 +75,13 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) {
// Read the token, don't allow macro expansion on it.
LexUnexpandedToken(MacroNameTok);
+ if (MacroNameTok.is(tok::code_completion)) {
+ if (CodeComplete)
+ CodeComplete->CodeCompleteMacroName(isDefineUndef == 1);
+ LexUnexpandedToken(MacroNameTok);
+ return;
+ }
+
// Missing macro name?
if (MacroNameTok.is(tok::eom)) {
Diag(MacroNameTok, diag::err_pp_missing_macro_name);
OpenPOWER on IntegriCloud