[cfe-commits] r149782 - in /cfe/trunk: 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

Benjamin Kramer benny.kra at googlemail.com
Sat Feb 4 05:02:15 PST 2012


Author: d0k
Date: Sat Feb  4 07:02:15 2012
New Revision: 149782

URL: http://llvm.org/viewvc/llvm-project?rev=149782&view=rev
Log:
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.

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

Modified: cfe/trunk/include/clang/Lex/PPCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PPCallbacks.h?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PPCallbacks.h (original)
+++ cfe/trunk/include/clang/Lex/PPCallbacks.h Sat Feb  4 07:02:15 2012
@@ -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 @@
   }
 
   /// 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 @@
   }
 
   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);
   }

Modified: cfe/trunk/include/clang/Lex/PTHManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PTHManager.h?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PTHManager.h (original)
+++ cfe/trunk/include/clang/Lex/PTHManager.h Sat Feb  4 07:02:15 2012
@@ -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>

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Sat Feb  4 07:02:15 2012
@@ -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 @@
 /// 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 @@
   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 @@
   /// 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

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Sat Feb  4 07:02:15 2012
@@ -128,7 +128,7 @@
   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 @@
 
 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;

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Sat Feb  4 07:02:15 2012
@@ -336,6 +336,21 @@
   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.

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Sat Feb  4 07:02:15 2012
@@ -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"

Modified: cfe/trunk/lib/Serialization/GeneratePCH.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GeneratePCH.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/GeneratePCH.cpp (original)
+++ cfe/trunk/lib/Serialization/GeneratePCH.cpp Sat Feb  4 07:02:15 2012
@@ -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"

Modified: cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp Sat Feb  4 07:02:15 2012
@@ -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;

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=149782&r1=149781&r2=149782&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Sat Feb  4 07:02:15 2012
@@ -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"





More information about the cfe-commits mailing list