diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-04 03:32:15 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-04 03:32:15 +0000 |
commit | 5cec2aea3f5c402bbf570bc71dc173562424c8d6 (patch) | |
tree | 831c0bb13a4db8c277d53fc819130d1abdb188d6 /clang/lib/Lex/PPDirectives.cpp | |
parent | a3deaeeb52acdc863ee98eb5bb20b419518bc592 (diff) | |
download | bcm5719-llvm-5cec2aea3f5c402bbf570bc71dc173562424c8d6.tar.gz bcm5719-llvm-5cec2aea3f5c402bbf570bc71dc173562424c8d6.zip |
Support code-completion for C++ inline methods and ObjC buffering methods.
Previously we would cut off the source file buffer at the code-completion
point; this impeded code-completion inside C++ inline methods and,
recently, with buffering ObjC methods.
Have the code-completion inserted into the source buffer so that it can
be buffered along with a method body. When we actually hit the code-completion
point the cut-off lexing or parsing.
Fixes rdar://10056932&8319466
llvm-svn: 139086
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index c8fcc3e37d1..be70ceccfa5 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -102,8 +102,8 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { if (MacroNameTok.is(tok::code_completion)) { if (CodeComplete) CodeComplete->CodeCompleteMacroName(isDefineUndef == 1); + setCodeCompletionReached(); LexUnexpandedToken(MacroNameTok); - return; } // Missing macro name? @@ -214,6 +214,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, if (Tok.is(tok::code_completion)) { if (CodeComplete) CodeComplete->CodeCompleteInConditionalExclusion(); + setCodeCompletionReached(); continue; } @@ -222,7 +223,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // Emit errors for each unterminated conditional on the stack, including // the current one. while (!CurPPLexer->ConditionalStack.empty()) { - if (!isCodeCompletionFile(Tok.getLocation())) + if (CurLexer->getFileLoc() != CodeCompletionFileLoc) Diag(CurPPLexer->ConditionalStack.back().IfLoc, diag::err_pp_unterminated_conditional); CurPPLexer->ConditionalStack.pop_back(); @@ -581,6 +582,7 @@ TryAgain: if (CodeComplete) CodeComplete->CodeCompleteDirective( CurPPLexer->getConditionalStackDepth() > 0); + setCodeCompletionReached(); return; case tok::numeric_constant: // # 7 GNU line marker directive. if (getLangOptions().AsmPreprocessor) @@ -1104,6 +1106,7 @@ bool Preprocessor::ConcatenateIncludeName( // FIXME: Provide code completion for #includes. if (CurTok.is(tok::code_completion)) { + setCodeCompletionReached(); Lex(CurTok); continue; } |