diff options
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index fc6efb6068..7b1ddf66f9 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -336,6 +336,21 @@ void Preprocessor::CodeCompleteNaturalLanguage() { setCodeCompletionReached(); } +void Preprocessor::setCodeCompletionReached() { + assert(isCodeCompletionEnabled() && "Code-completion not enabled!"); + CodeCompletionReached = true; + // Silence any diagnostics that occur after we hit the code-completion. + getDiagnostics().setSuppressAllDiagnostics(true); +} + +DiagnosticBuilder Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) const{ + return Diags->Report(Loc, DiagID); +} + +DiagnosticBuilder Preprocessor::Diag(const Token &Tok, unsigned DiagID) const { + return Diags->Report(Tok.getLocation(), DiagID); +} + /// getSpelling - This method is used to get the spelling of a token into a /// SmallVector. Note that the returned StringRef may not point to the /// supplied buffer if a copy can be avoided. |