]> granicus.if.org Git - clang/commitdiff
Remove Diagnostic.h include from Preprocessor.h.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 4 Feb 2012 13:02:15 +0000 (13:02 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 4 Feb 2012 13:02:15 +0000 (13:02 +0000)
- 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

include/clang/Lex/PPCallbacks.h
include/clang/Lex/PTHManager.h
include/clang/Lex/Preprocessor.h
lib/Frontend/PrintPreprocessedOutput.cpp
lib/Lex/Preprocessor.cpp
lib/Rewrite/HTMLRewrite.cpp
lib/Serialization/GeneratePCH.cpp
lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

index 19e8521ea128de5b3871974b8602560d0df9332a..987d6167c656f44ca1931c60f52059a40bfac32b 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "clang/Lex/DirectoryLookup.h"
 #include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/DiagnosticIDs.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
 
@@ -158,9 +157,10 @@ public:
   }
 
   /// PragmaDiagnostic - This callback is invoked when a
-  /// #pragma gcc dianostic directive is read.
+  /// #pragma gcc diagnostic directive is read.
+  /// Mapping is an element of the diag::Mapping enum.
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                diag::Mapping mapping, StringRef Str) {
+                                unsigned mapping, StringRef Str) {
   }
 
   /// MacroExpands - This is called by
@@ -303,7 +303,7 @@ public:
   }
 
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                diag::Mapping mapping, StringRef Str) {
+                                unsigned mapping, StringRef Str) {
     First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
     Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
   }
index 25a49038a863d9b5a862fb4d1b6c8451c6c69df0..6ae3a7167ec20faaf28f6c3bf0fa6b1a53c0ee05 100644 (file)
@@ -17,7 +17,6 @@
 #include "clang/Lex/PTHLexer.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/Diagnostic.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Allocator.h"
 #include <string>
index 33efbd960cedee87c8202ac785757a0f5b3edbae..dc93b625c3d22c6e93ff19852c2ae2cdc2afe781 100644 (file)
@@ -21,7 +21,6 @@
 #include "clang/Lex/TokenLexer.h"
 #include "clang/Lex/PTHManager.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
@@ -57,7 +56,7 @@ class ModuleLoader;
 /// like the #include stack, token expansion, etc.
 ///
 class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
-  DiagnosticsEngine        *Diags;
+  DiagnosticsEngine *Diags;
   LangOptions       &Features;
   const TargetInfo  *Target;
   FileManager       &FileMgr;
@@ -725,12 +724,7 @@ public:
   bool isCodeCompletionReached() const { return CodeCompletionReached; }
 
   /// \brief Note that we hit the code-completion point.
-  void setCodeCompletionReached() {
-    assert(isCodeCompletionEnabled() && "Code-completion not enabled!");
-    CodeCompletionReached = true;
-    // Silence any diagnostics that occur after we hit the code-completion.
-    getDiagnostics().setSuppressAllDiagnostics(true);
-  }
+  void setCodeCompletionReached();
 
   /// \brief The location of the currently-active #pragma clang
   /// arc_cf_code_audited begin.  Returns an invalid location if there
@@ -760,13 +754,9 @@ public:
   /// Diag - Forwarding function for diagnostics.  This emits a diagnostic at
   /// the specified Token's location, translating the token's start
   /// position in the current buffer into a SourcePosition object for rendering.
-  DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const {
-    return Diags->Report(Loc, DiagID);
-  }
+  DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const;
 
-  DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const {
-    return Diags->Report(Tok.getLocation(), DiagID);
-  }
+  DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const;
 
   /// getSpelling() - Return the 'spelling' of the token at the given
   /// location; does not go up to the spelling location or down to the
index 5e76a79ae14622c24f249b676a86d7dc35a80c60..93dd00425196d1291a5094e4a87f57cd455ee4a7 100644 (file)
@@ -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;
index fc6efb606890d41fca5b802e5a50c4a509d8a3a1..7b1ddf66f9b8199bb2856f3b4de29bb306f8e13f 100644 (file)
@@ -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.
index beb8985204844936322af550814edeb622ea0f8b..77c99690401bfdf7e8b5d83880b80418d8ef044a 100644 (file)
@@ -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"
index 02aed103f1bfcae668f44c803cca5136bd43b96b..9a6564d61ef256eb1f2603373e0bf814aa4f8f61 100644 (file)
@@ -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"
index 0c6b2282741a53d49ca442184a5109d3cbce6b1f..575db607a97250f85efa64cbef30fc341947dd54 100644 (file)
@@ -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;
index e13b86c1c1daae3dbdb634ed9ac1f870d3a6a5d3..ba64d98b98889789dd42e24d498d713d1b99de28 100644 (file)
@@ -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"