diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-04 13:02:15 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-02-04 13:02:15 +0000 |
commit | fdd15602a42bbe26185978ef1e17019f6d969aa7 (patch) | |
tree | ccbaf7edee98ff7893e5d30535d62bb30a9a566a /lib | |
parent | 00bd44d5677783527d7517c1ffe45e4d75a0f56f (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')
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 6 | ||||
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 15 | ||||
-rw-r--r-- | lib/Rewrite/HTMLRewrite.cpp | 1 | ||||
-rw-r--r-- | lib/Serialization/GeneratePCH.cpp | 1 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp | 1 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 1 |
6 files changed, 22 insertions, 3 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 5e76a79ae1..93dd004251 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -128,7 +128,7 @@ public: virtual void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace); virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, - diag::Mapping Map, StringRef Str); + unsigned Map, StringRef Str); bool HandleFirstTokOnLine(Token &Tok); bool MoveToLine(SourceLocation Loc) { @@ -385,10 +385,10 @@ PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) { void PrintPPOutputPPCallbacks:: PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, - diag::Mapping Map, StringRef Str) { + unsigned Map, StringRef Str) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic "; - switch (Map) { + switch ((diag::Mapping)Map) { case diag::MAP_WARNING: OS << "warning"; break; 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. diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index beb8985204..77c9969040 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -17,6 +17,7 @@ #include "clang/Rewrite/HTMLRewrite.h" #include "clang/Lex/TokenConcatenation.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp index 02aed103f1..9a6564d61e 100644 --- a/lib/Serialization/GeneratePCH.cpp +++ b/lib/Serialization/GeneratePCH.cpp @@ -17,6 +17,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/ASTConsumer.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemStatCache.h" #include "llvm/Bitcode/BitstreamWriter.h" diff --git a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp index 0c6b228274..575db607a9 100644 --- a/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp @@ -13,6 +13,7 @@ #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h" #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Lex/Preprocessor.h" #include "llvm/Support/raw_ostream.h" using namespace clang; diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index e13b86c1c1..ba64d98b98 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -27,6 +27,7 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Frontend/AnalyzerOptions.h" |