aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-04 13:02:15 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-04 13:02:15 +0000
commitfdd15602a42bbe26185978ef1e17019f6d969aa7 (patch)
treeccbaf7edee98ff7893e5d30535d62bb30a9a566a /lib/Lex/Preprocessor.cpp
parent00bd44d5677783527d7517c1ffe45e4d75a0f56f (diff)
Remove Diagnostic.h include from Preprocessor.h.
- Move the offending methods out of line and fix transitive includers. - This required changing an enum in the PPCallback API into an unsigned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp15
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.