]> granicus.if.org Git - clang/commitdiff
Revert my patches which removed Diagnostic.h includes by moving some operator overloa...
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 7 Feb 2012 22:29:24 +0000 (22:29 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 7 Feb 2012 22:29:24 +0000 (22:29 +0000)
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8

46 files changed:
include/clang/AST/ASTContext.h
include/clang/AST/CanonicalType.h
include/clang/AST/Decl.h
include/clang/AST/DeclarationName.h
include/clang/AST/Mangle.h
include/clang/AST/NestedNameSpecifier.h
include/clang/AST/Type.h
include/clang/Basic/Diagnostic.h
include/clang/Basic/PartialDiagnostic.h
include/clang/Lex/PPCallbacks.h
include/clang/Lex/PTHManager.h
include/clang/Lex/Preprocessor.h
include/clang/Sema/CodeCompleteConsumer.h
include/clang/Sema/DelayedDiagnostic.h
include/clang/Sema/Sema.h
include/clang/Sema/SemaFixItUtils.h
include/clang/Serialization/ASTWriter.h
lib/AST/ASTContext.cpp
lib/AST/Decl.cpp
lib/AST/DeclCXX.cpp
lib/AST/DeclarationName.cpp
lib/AST/ExprConstant.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/NestedNameSpecifier.cpp
lib/AST/Type.cpp
lib/Basic/Diagnostic.cpp
lib/CodeGen/CGCXXABI.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CodeGenTBAA.cpp
lib/Frontend/PrintPreprocessedOutput.cpp
lib/Lex/Preprocessor.cpp
lib/Rewrite/HTMLRewrite.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/GeneratePCH.cpp
lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
lib/StaticAnalyzer/Checkers/StreamChecker.cpp
lib/StaticAnalyzer/Core/AnalysisManager.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/CheckerRegistry.cpp
lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
tools/libclang/IndexingContext.h

index a23447197bdbf3ff5153d9ce58b19fcbc36e294a..c0d191e565d29e185c027a6947a117c962770a50 100644 (file)
@@ -18,6 +18,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/OperatorKinds.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/VersionTuple.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/NestedNameSpecifier.h"
@@ -48,7 +49,6 @@ namespace clang {
   class ExternalASTSource;
   class ASTMutationListener;
   class IdentifierTable;
-  class PartialDiagnosticStorageAllocator;
   class SelectorTable;
   class SourceManager;
   class TargetInfo;
@@ -346,7 +346,7 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> {
   mutable llvm::BumpPtrAllocator BumpAlloc;
 
   /// \brief Allocator for partial diagnostics.
-  PartialDiagnosticStorageAllocator *DiagAllocator;
+  PartialDiagnostic::StorageAllocator DiagAllocator;
 
   /// \brief The current C++ ABI.
   OwningPtr<CXXABI> ABI;
@@ -391,8 +391,8 @@ public:
   /// Return the total memory used for various side tables.
   size_t getSideTableAllocatedMemory() const;
   
-  PartialDiagnosticStorageAllocator &getDiagAllocator() {
-    return *DiagAllocator;
+  PartialDiagnostic::StorageAllocator &getDiagAllocator() {
+    return DiagAllocator;
   }
 
   const TargetInfo &getTargetInfo() const { return *Target; }
index 5b27b4e1faf8458f0ec429d5d2c6654b05659bff..38e6b41977f87b26e5756f73cf5fa71189936c82 100644 (file)
@@ -200,7 +200,11 @@ inline CanQualType Type::getCanonicalTypeUnqualified() const {
   return CanQualType::CreateUnsafe(getCanonicalTypeInternal());
 }
 
-const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, CanQualType T);
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           CanQualType T) {
+  DB << static_cast<QualType>(T);
+  return DB;
+}
 
 //----------------------------------------------------------------------------//
 // Internal proxy classes used by canonical types
index 37c962357dcff62c2b5ae22ba1ec4e18efa5c6ab..24d2d85385936c3288866fb0e05f6d29eaab878a 100644 (file)
@@ -41,11 +41,7 @@ class TypeLoc;
 class UnresolvedSetImpl;
 class LabelStmt;
 class Module;
-
-// Forward declare PartialDiagnosticAt.
-// FIXME: This shouldn't be here.
-typedef std::pair<SourceLocation, PartialDiagnostic> PartialDiagnosticAt;
-
+  
 /// \brief A container of type source information.
 ///
 /// A client can read the relevant info using TypeLoc wrappers, e.g:
@@ -3179,11 +3175,18 @@ public:
 
 /// Insertion operator for diagnostics.  This allows sending NamedDecl's
 /// into a diagnostic with <<.
-const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                    const NamedDecl* ND);
-
-const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
-                                    const NamedDecl* ND);
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           const NamedDecl* ND) {
+  DB.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
+                  DiagnosticsEngine::ak_nameddecl);
+  return DB;
+}
+inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+                                           const NamedDecl* ND) {
+  PD.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
+                  DiagnosticsEngine::ak_nameddecl);
+  return PD;
+}
 
 template<typename decl_type>
 void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {
index 0d87e2671c9029846537da8c14e1fc2d575d8bd6..2170f2b1ef7f555e6b091ad3a3f090db47b91026 100644 (file)
@@ -16,6 +16,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/CanonicalType.h"
+#include "clang/Basic/PartialDiagnostic.h"
 
 namespace llvm {
   template <typename T> struct DenseMapInfo;
@@ -516,16 +517,24 @@ public:
 
 /// Insertion operator for diagnostics.  This allows sending DeclarationName's
 /// into a diagnostic with <<.
-const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                    DeclarationName N);
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           DeclarationName N) {
+  DB.AddTaggedVal(N.getAsOpaqueInteger(),
+                  DiagnosticsEngine::ak_declarationname);
+  return DB;
+}
 
 /// Insertion operator for partial diagnostics.  This allows binding
 /// DeclarationName's into a partial diagnostic with <<.
-const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
-                                    DeclarationName N);
+inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+                                           DeclarationName N) {
+  PD.AddTaggedVal(N.getAsOpaqueInteger(),
+                  DiagnosticsEngine::ak_declarationname);
+  return PD;
+}
 
 inline raw_ostream &operator<<(raw_ostream &OS,
-                               DeclarationNameInfo DNInfo) {
+                                     DeclarationNameInfo DNInfo) {
   DNInfo.printName(OS);
   return OS;
 }
index ed392ab6b68d9ba897c579571f0ca83b8d268002..ca22ed6a0d970727d71ca332d107acae5d707481 100644 (file)
@@ -27,8 +27,6 @@ namespace clang {
   class CXXConstructorDecl;
   class CXXDestructorDecl;
   class CXXMethodDecl;
-  class DeclContext;
-  class DiagnosticsEngine;
   class FunctionDecl;
   class NamedDecl;
   class ObjCMethodDecl;
index 8d4a53f23ea7d45c4098c3c19448dae2d426e372..bda2d31fd5a4892389f9a1594cd16d39e78cb4a7 100644 (file)
 #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
 #define LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
 
-#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/Diagnostic.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
 
 namespace clang {
 
 class ASTContext;
-class DiagnosticBuilder;
 class NamespaceAliasDecl;
 class NamespaceDecl;
 class IdentifierInfo;
@@ -465,8 +464,12 @@ public:
 
 /// Insertion operator for diagnostics.  This allows sending
 /// NestedNameSpecifiers into a diagnostic with <<.
-const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                    NestedNameSpecifier *NNS);
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           NestedNameSpecifier *NNS) {
+  DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS),
+                  DiagnosticsEngine::ak_nestednamespec);
+  return DB;
+}
 
 }
 
index b989d55500687829b59d87257e9a13f1d18535d2..641f732c599ade521f10e2a8afa0adf2959eb10f 100644 (file)
 #ifndef LLVM_CLANG_AST_TYPE_H
 #define LLVM_CLANG_AST_TYPE_H
 
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/Linkage.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Visibility.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TemplateName.h"
@@ -92,7 +94,6 @@ namespace clang {
   class ExtQuals;
   class ExtQualsTypeCommonBase;
   struct PrintingPolicy;
-  class PartialDiagnostic;
 
   template <typename> class CanQual;
   typedef CanQual<Type> CanQualType;
@@ -4801,11 +4802,21 @@ inline const Type *Type::getBaseElementTypeUnsafe() const {
 
 /// Insertion operator for diagnostics.  This allows sending QualType's into a
 /// diagnostic with <<.
-const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, QualType T);
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           QualType T) {
+  DB.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
+                  DiagnosticsEngine::ak_qualtype);
+  return DB;
+}
 
 /// Insertion operator for partial diagnostics.  This allows sending QualType's
 /// into a diagnostic with <<.
-const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, QualType T);
+inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+                                           QualType T) {
+  PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
+                  DiagnosticsEngine::ak_qualtype);
+  return PD;
+}
 
 // Helper class template that is used by Type::getAs to ensure that one does
 // not try to look through a qualified type to get to an array type.
index b9815125c36c0f776251ceed711bd38f42020d9d..224f1a45d1caf37fb19af726dacace6174700e8c 100644 (file)
@@ -601,7 +601,6 @@ private:
   friend class DiagnosticBuilder;
   friend class Diagnostic;
   friend class PartialDiagnostic;
-  friend struct PartialDiagnosticStorage;
   friend class DiagnosticErrorTrap;
   
   /// CurDiagLoc - This is the location of the current diagnostic that is in
index 7bc9f546557bd22b071050054d343b27d1162caa..f6092e685819d323b15a4ca4d1e7eef14e983606 100644 (file)
 
 namespace clang {
 
-struct PartialDiagnosticStorage {
-  PartialDiagnosticStorage() : NumDiagArgs(0), NumDiagRanges(0) { }
-
+class PartialDiagnostic {
+public:
   enum {
-      /// MaxArguments - The maximum number of arguments we can hold. We
-      /// currently only support up to 10 arguments (%0-%9).
-      /// A single diagnostic with more than that almost certainly has to
-      /// be simplified anyway.
+      // The MaxArguments and MaxFixItHints member enum values from
+      // DiagnosticsEngine are private but DiagnosticsEngine declares
+      // PartialDiagnostic a friend.  These enum values are redeclared
+      // here so that the nested Storage class below can access them.
       MaxArguments = DiagnosticsEngine::MaxArguments
   };
 
-  /// NumDiagArgs - This contains the number of entries in Arguments.
-  unsigned char NumDiagArgs;
-
-  /// NumDiagRanges - This is the number of ranges in the DiagRanges array.
-  unsigned char NumDiagRanges;
-
-  /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum
-  /// values, with one for each argument.  This specifies whether the argument
-  /// is in DiagArgumentsStr or in DiagArguments.
-  unsigned char DiagArgumentsKind[MaxArguments];
-
-  /// DiagArgumentsVal - The values for the various substitution positions.
-  /// This is used when the argument is not an std::string. The specific value
-  /// is mangled into an intptr_t and the interpretation depends on exactly
-  /// what sort of argument kind it is.
-  intptr_t DiagArgumentsVal[MaxArguments];
-
-  /// \brief The values for the various substitution positions that have
-  /// string arguments.
-  std::string DiagArgumentsStr[MaxArguments];
-
-  /// DiagRanges - The list of ranges added to this diagnostic.  It currently
-  /// only support 10 ranges, could easily be extended if needed.
-  CharSourceRange DiagRanges[10];
-
-  /// FixItHints - If valid, provides a hint with some code
-  /// to insert, remove, or modify at a particular position.
-  SmallVector<FixItHint, 6>  FixItHints;
-};
-
-/// \brief An allocator for Storage objects, which uses a small cache to
-/// objects, used to reduce malloc()/free() traffic for partial diagnostics.
-class PartialDiagnosticStorageAllocator {
-  static const unsigned NumCached = 16;
-  typedef PartialDiagnosticStorage Storage;
-  Storage Cached[NumCached];
-  Storage *FreeList[NumCached];
-  unsigned NumFreeListEntries;
-
-public:
-  PartialDiagnosticStorageAllocator();
-  ~PartialDiagnosticStorageAllocator();
-
-  /// \brief Allocate new storage.
-  Storage *Allocate() {
-    if (NumFreeListEntries == 0)
-      return new Storage;
-
-    Storage *Result = FreeList[--NumFreeListEntries];
-    Result->NumDiagArgs = 0;
-    Result->NumDiagRanges = 0;
-    Result->FixItHints.clear();
-    return Result;
-  }
+  struct Storage {
+    Storage() : NumDiagArgs(0), NumDiagRanges(0) { }
+
+    enum {
+        /// MaxArguments - The maximum number of arguments we can hold. We
+        /// currently only support up to 10 arguments (%0-%9).
+        /// A single diagnostic with more than that almost certainly has to
+        /// be simplified anyway.
+        MaxArguments = PartialDiagnostic::MaxArguments
+    };
+
+    /// NumDiagArgs - This contains the number of entries in Arguments.
+    unsigned char NumDiagArgs;
+
+    /// NumDiagRanges - This is the number of ranges in the DiagRanges array.
+    unsigned char NumDiagRanges;
+
+    /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum
+    /// values, with one for each argument.  This specifies whether the argument
+    /// is in DiagArgumentsStr or in DiagArguments.
+    unsigned char DiagArgumentsKind[MaxArguments];
+
+    /// DiagArgumentsVal - The values for the various substitution positions.
+    /// This is used when the argument is not an std::string. The specific value
+    /// is mangled into an intptr_t and the interpretation depends on exactly
+    /// what sort of argument kind it is.
+    intptr_t DiagArgumentsVal[MaxArguments];
+
+    /// \brief The values for the various substitution positions that have
+    /// string arguments.
+    std::string DiagArgumentsStr[MaxArguments];
+
+    /// DiagRanges - The list of ranges added to this diagnostic.  It currently
+    /// only support 10 ranges, could easily be extended if needed.
+    CharSourceRange DiagRanges[10];
+
+    /// FixItHints - If valid, provides a hint with some code
+    /// to insert, remove, or modify at a particular position.
+    SmallVector<FixItHint, 6>  FixItHints;
+  };
 
-  /// \brief Free the given storage object.
-  void Deallocate(Storage *S) {
-    if (S >= Cached && S <= Cached + NumCached) {
-      FreeList[NumFreeListEntries++] = S;
-      return;
+  /// \brief An allocator for Storage objects, which uses a small cache to
+  /// objects, used to reduce malloc()/free() traffic for partial diagnostics.
+  class StorageAllocator {
+    static const unsigned NumCached = 16;
+    Storage Cached[NumCached];
+    Storage *FreeList[NumCached];
+    unsigned NumFreeListEntries;
+
+  public:
+    StorageAllocator();
+    ~StorageAllocator();
+
+    /// \brief Allocate new storage.
+    Storage *Allocate() {
+      if (NumFreeListEntries == 0)
+        return new Storage;
+
+      Storage *Result = FreeList[--NumFreeListEntries];
+      Result->NumDiagArgs = 0;
+      Result->NumDiagRanges = 0;
+      Result->FixItHints.clear();
+      return Result;
     }
 
-    delete S;
-  }
-};
+    /// \brief Free the given storage object.
+    void Deallocate(Storage *S) {
+      if (S >= Cached && S <= Cached + NumCached) {
+        FreeList[NumFreeListEntries++] = S;
+        return;
+      }
 
-class PartialDiagnostic {
-public:
-  typedef PartialDiagnosticStorage Storage;
-  typedef PartialDiagnosticStorageAllocator StorageAllocator;
+      delete S;
+    }
+  };
 
 private:
   // NOTE: Sema assumes that PartialDiagnostic is location-invariant
index 987d6167c656f44ca1931c60f52059a40bfac32b..19e8521ea128de5b3871974b8602560d0df9332a 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "clang/Lex/DirectoryLookup.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/DiagnosticIDs.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
 
@@ -157,10 +158,9 @@ public:
   }
 
   /// PragmaDiagnostic - This callback is invoked when a
-  /// #pragma gcc diagnostic directive is read.
-  /// Mapping is an element of the diag::Mapping enum.
+  /// #pragma gcc dianostic directive is read.
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                unsigned mapping, StringRef Str) {
+                                diag::Mapping mapping, StringRef Str) {
   }
 
   /// MacroExpands - This is called by
@@ -303,7 +303,7 @@ public:
   }
 
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                unsigned mapping, StringRef Str) {
+                                diag::Mapping mapping, StringRef Str) {
     First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
     Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
   }
index 6ae3a7167ec20faaf28f6c3bf0fa6b1a53c0ee05..25a49038a863d9b5a862fb4d1b6c8451c6c69df0 100644 (file)
@@ -17,6 +17,7 @@
 #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 77dc2348a54c130b847ed2dc4f6fd89f68c2d5da..9c3b64abb07f23e4935f5e9ae9bb9841972686d9 100644 (file)
@@ -21,6 +21,7 @@
 #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"
@@ -60,7 +61,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;
@@ -728,7 +729,12 @@ public:
   bool isCodeCompletionReached() const { return CodeCompletionReached; }
 
   /// \brief Note that we hit the code-completion point.
-  void setCodeCompletionReached();
+  void setCodeCompletionReached() {
+    assert(isCodeCompletionEnabled() && "Code-completion not enabled!");
+    CodeCompletionReached = true;
+    // Silence any diagnostics that occur after we hit the code-completion.
+    getDiagnostics().setSuppressAllDiagnostics(true);
+  }
 
   /// \brief The location of the currently-active #pragma clang
   /// arc_cf_code_audited begin.  Returns an invalid location if there
@@ -758,9 +764,13 @@ 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;
+  DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const {
+    return Diags->Report(Loc, DiagID);
+  }
 
-  DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const;
+  DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const {
+    return Diags->Report(Tok.getLocation(), DiagID);
+  }
 
   /// getSpelling() - Return the 'spelling' of the token at the given
   /// location; does not go up to the spelling location or down to the
index 832c47d6afd12bc6a178100a28a613a2b4339bc3..c77b68f9da749b3b07f73fc7f69e2afbe38f7a89 100644 (file)
@@ -24,7 +24,6 @@
 namespace clang {
 
 class Decl;
-class Preprocessor;
 
 /// \brief Default priority values for code-completion results based
 /// on their kind.
index 235f63438515eeb09e2ecf1448cecb9256f33bb1..dd2603dbc362092b20c08fcd6049be33abcc35ec 100644 (file)
@@ -22,7 +22,6 @@
 #define LLVM_CLANG_SEMA_DELAYED_DIAGNOSTIC_H
 
 #include "clang/AST/DeclCXX.h"
-#include "clang/Basic/PartialDiagnostic.h"
 
 namespace clang {
 namespace sema {
index e7a1864030264480d36e7b6ba1e7cefee2fb9092..e7441ada130591ee1935fba7398ab6a45a3f2002 100644 (file)
@@ -30,7 +30,6 @@
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Lex/ModuleLoader.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TemplateKinds.h"
 #include "clang/Basic/TypeTraits.h"
index 84e03d8242a078d4f6753b129b94f8c375de9072..fffca6791454b5e25243d4a5bb8f41e8a750c296 100644 (file)
@@ -14,7 +14,6 @@
 #define LLVM_CLANG_SEMA_FIXITUTILS_H
 
 #include "clang/AST/Expr.h"
-#include "clang/Basic/Diagnostic.h"
 
 namespace clang {
 
index e36f3a00a655cf4a48bbb434eb559540833278aa..f6a2c4817a5321b124640ad84d8549582dac2d30 100644 (file)
@@ -43,7 +43,6 @@ class ASTContext;
 class NestedNameSpecifier;
 class CXXBaseSpecifier;
 class CXXCtorInitializer;
-class DiagnosticsEngine;
 class FPOptions;
 class HeaderSearch;
 class IdentifierResolver;
index 416045e2342e93f625796f0adf17217d164090d4..069f1068da387c36f4c089957aabfbe6ee54922a 100644 (file)
@@ -24,7 +24,6 @@
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/Mangle.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallString.h"
@@ -242,9 +241,6 @@ ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM,
     LastSDM(0, 0),
     UniqueBlockByRefTypeID(0) 
 {
-  // Create a new allocator for partial diagnostics.
-  DiagAllocator = new (BumpAlloc) PartialDiagnosticStorageAllocator;
-
   if (size_reserve > 0) Types.reserve(size_reserve);
   TUDecl = TranslationUnitDecl::Create(*this);
   
@@ -289,9 +285,6 @@ ASTContext::~ASTContext() {
                                                     AEnd = DeclAttrs.end();
        A != AEnd; ++A)
     A->second->~AttrVec();
-
-  // Destroy the partial diagnostic allocator.
-  DiagAllocator->~PartialDiagnosticStorageAllocator();
 }
 
 void ASTContext::AddDeallocation(void (*Callback)(void*), void *Data) {
index 03cfc83eca53273bcfc15e6ef62c30f2346fe550..d80e06b322a5df38541b50deaa04752c5f229d6f 100644 (file)
@@ -25,7 +25,6 @@
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/Module.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -3002,17 +3001,3 @@ SourceRange ImportDecl::getSourceRange() const {
   
   return SourceRange(getLocation(), getIdentifierLocs().back());
 }
-
-const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
-                                           const NamedDecl* ND) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
-                  DiagnosticsEngine::ak_nameddecl);
-  return DB;
-}
-
-const PartialDiagnostic &clang::operator<<(const PartialDiagnostic &PD,
-                                           const NamedDecl* ND) {
-  PD.AddTaggedVal(reinterpret_cast<intptr_t>(ND),
-                  DiagnosticsEngine::ak_nameddecl);
-  return PD;
-}
index d64385a5b9875ed93487807cc73d85810ececea1..d5221031a54a83a0d1f2d433d1335ce4094ee901 100644 (file)
@@ -20,7 +20,6 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 using namespace clang;
index f550cf89089321bbb5bc730dfca0160acf8943ed..a5488e67ca234e51a56929f8e2c7088488fcd536 100644 (file)
@@ -18,7 +18,6 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -621,17 +620,3 @@ SourceLocation DeclarationNameInfo::getEndLoc() const {
   }
   llvm_unreachable("Unexpected declaration name kind");
 }
-
-const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
-                                           DeclarationName N) {
-  DB.AddTaggedVal(N.getAsOpaqueInteger(),
-                  DiagnosticsEngine::ak_declarationname);
-  return DB;
-}
-
-const PartialDiagnostic &clang::operator<<(const PartialDiagnostic &PD,
-                                           DeclarationName N) {
-  PD.AddTaggedVal(N.getAsOpaqueInteger(),
-                  DiagnosticsEngine::ak_declarationname);
-  return PD;
-}
index 283132a3568d5a0cb729130ce65f7ba82c8dbe31..e33d22a4aa35cbdb950f9de6112dde631a367191 100644 (file)
@@ -42,7 +42,6 @@
 #include "clang/AST/ASTDiagnostic.h"
 #include "clang/AST/Expr.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallString.h"
 #include <cstring>
index e39031dcedff303d85e989f9d213b39404cb785e..59192428b88e0101188a11806b3430dde07394b0 100644 (file)
@@ -24,7 +24,6 @@
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/ABI.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringExtras.h"
index 9b714ed7e8846172286debbc809c93820302a754..c59d40a8c2bf07fd66bd36163ccabc304e64def8 100644 (file)
@@ -18,7 +18,6 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
-#include "clang/Basic/Diagnostic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 
@@ -640,9 +639,3 @@ NestedNameSpecifierLocBuilder::getWithLocInContext(ASTContext &Context) const {
   return NestedNameSpecifierLoc(Representation, Mem);
 }
 
-const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
-                                           NestedNameSpecifier *NNS) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS),
-                  DiagnosticsEngine::ak_nestednamespec);
-  return DB;
-}
index be38ba66bc0d6dbec10cf78f96519982d0ccdc69..ebf5706ed038dd37fc824a9c734f9a48cece0d90 100644 (file)
@@ -20,7 +20,6 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/TypeVisitor.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/StringExtras.h"
@@ -2310,23 +2309,3 @@ bool QualType::hasTrivialAssignment(ASTContext &Context, bool Copying) const {
   
   return true;
 }
-
-const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
-                                           QualType T) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
-                  DiagnosticsEngine::ak_qualtype);
-  return DB;
-}
-
-const PartialDiagnostic &clang::operator<<(const PartialDiagnostic &PD,
-                                           QualType T) {
-  PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
-                  DiagnosticsEngine::ak_qualtype);
-  return PD;
-}
-
-const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
-                                           CanQualType T) {
-  DB << static_cast<QualType>(T);
-  return DB;
-}
index 268b024c7e0e29e0b1eb88da8a48092bd26613ca..41f66c49d3e00db2f7aad538b5c030edde8ecc7a 100644 (file)
@@ -877,13 +877,13 @@ bool DiagnosticConsumer::IncludeInDiagnosticCounts() const { return true; }
 
 void IgnoringDiagConsumer::anchor() { }
 
-PartialDiagnosticStorageAllocator::PartialDiagnosticStorageAllocator() {
+PartialDiagnostic::StorageAllocator::StorageAllocator() {
   for (unsigned I = 0; I != NumCached; ++I)
     FreeList[I] = Cached + I;
   NumFreeListEntries = NumCached;
 }
 
-PartialDiagnosticStorageAllocator::~PartialDiagnosticStorageAllocator() {
+PartialDiagnostic::StorageAllocator::~StorageAllocator() {
   // Don't assert if we are in a CrashRecovery context, as this
   // invariant may be invalidated during a crash.
   assert((NumFreeListEntries == NumCached || llvm::CrashRecoveryContext::isRecoveringFromCrash()) && "A partial is on the lamb");
index 05f52a0b878f4169ba1ccf52c1bcde2df26feebf..c1b20af799fcc103b8e6d246129cc270980910f2 100644 (file)
@@ -13,7 +13,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "CGCXXABI.h"
-#include "clang/Basic/Diagnostic.h"
 
 using namespace clang;
 using namespace CodeGen;
index f1b986ef41c406ce2c71ddb487c69c035ff082e4..335b527e56d02c8e297065bde4e68f93e3ec0ed5 100644 (file)
@@ -21,9 +21,8 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/RecordLayout.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/FileManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/Constants.h"
index 401ad10638fd5e4adc71f9404e31cdeeb4c9d27b..148081e928efb9d1b04bd5d27aceb24a50a3589d 100644 (file)
@@ -22,7 +22,6 @@
 #include "llvm/Metadata.h"
 #include "llvm/Constants.h"
 #include "llvm/Type.h"
-#include "llvm/ADT/STLExtras.h"
 using namespace clang;
 using namespace CodeGen;
 
index 43b64b218696b776411907258ae936c550e3cdbc..f62ca579d109dc121a3819432f4a45436d9dba33 100644 (file)
@@ -128,7 +128,7 @@ public:
   virtual void PragmaDiagnosticPop(SourceLocation Loc,
                                    StringRef Namespace);
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                unsigned Map, StringRef Str);
+                                diag::Mapping 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,
-                 unsigned Map, StringRef Str) {
+                 diag::Mapping Map, StringRef Str) {
   MoveToLine(Loc);
   OS << "#pragma " << Namespace << " diagnostic ";
-  switch ((diag::Mapping)Map) {
+  switch (Map) {
   case diag::MAP_WARNING:
     OS << "warning";
     break;
index 7033e9c854c8d6bc2db32e913b78b3a39d84b3aa..75ab89d4d9be9d28317e130c42cfed8854f7eba4 100644 (file)
@@ -336,21 +336,6 @@ 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 44d635a527c9fb761c4ae4e64c36da50f54e2ffa..63b7def52ac8fccb6eac94422f2f8c55ee2f2bd7 100644 (file)
@@ -17,7 +17,6 @@
 #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 447250a2aa5ded2b48ec72ea1f04039ca060cb44..71bf3359ea990a4ecb83257db785438a9ba78c63 100644 (file)
@@ -16,7 +16,6 @@
 #include "clang/Sema/AnalysisBasedWarnings.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Sema/ScopeInfo.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Preprocessor.h"
index f24571828a8cc81180923fd27c285568d67d00e8..827fbed177a24cee62ee7b1ce1e1d8177d9070e9 100644 (file)
@@ -29,7 +29,6 @@
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/HeaderSearch.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "clang/Basic/OnDiskHashTable.h"
index 9a6564d61ef256eb1f2603373e0bf814aa4f8f61..02aed103f1bfcae668f44c803cca5136bd43b96b 100644 (file)
@@ -17,7 +17,6 @@
 #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 e372dbf3cb9dc248f4e6bd84450e6861741ba95e..0b11a459ce4b9ca23bc86c18e96c3df9cf13ab47 100644 (file)
@@ -17,7 +17,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index bcc4ad0f266ae2ff0404472f18bef21eefdb02e5..ca71ca33a1604d4375e91e6c5be35cd0f03a7e1f 100644 (file)
@@ -17,7 +17,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index 96301e7823752a8c4c4fca6b54722672fe75d537..d70fdfd8e89d806edafe48d2d0f9019d9adcb943 100644 (file)
@@ -20,7 +20,6 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Checkers/DereferenceChecker.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index f6f01b81a25d40099d79609fa7745eb7b16bcaaa..2d018ef9264deb1fa83db9268c1a2fc90396aee9 100644 (file)
@@ -19,7 +19,6 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/ImmutableList.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index 137b8cea98dc0b8b6b35165ea723200b84a3a20f..54fd70ab37db46e9cdd9161030d8fc0720e46aa1 100644 (file)
@@ -20,7 +20,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/ImmutableMap.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index 4d73b9d9610527b3f065b9aa40f9f2ca7cfc4504..af18eff89914f32e599ae8cfe0de51193f0461f6 100644 (file)
@@ -10,7 +10,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/Index/Entity.h"
 #include "clang/Index/Indexer.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index 299fad147884637548639ccffee4955b19c4c463..8e5ea361097d22ba44aa1043893c9a29d8a6889c 100644 (file)
@@ -21,7 +21,6 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ParentMap.h"
 #include "clang/AST/StmtObjC.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
index b87a7547c0bdd3a7e67646420ddf11e494c8478b..9791e2ecbf92dba6e2dabac42e1c167096a3cd38 100644 (file)
@@ -10,7 +10,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerRegistry.h"
 #include "clang/StaticAnalyzer/Core/CheckerOptInfo.h"
 #include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang;
 using namespace ento;
index 575db607a97250f85efa64cbef30fc341947dd54..0c6b2282741a53d49ca442184a5109d3cbce6b1f 100644 (file)
@@ -13,7 +13,6 @@
 
 #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 6e658f9a4dad73eb158878a4762c66434d4e666d..93c879ee96ae4694ce7cdd7b47f70dd91c553613 100644 (file)
@@ -27,7 +27,6 @@
 #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"
index 24afaea290d15282f411943b7043933e374dce41..bc33005e89dde3eb9218f37daa665fb1052e5757 100644 (file)
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclGroup.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
 
 namespace clang {
   class FileEntry;
   class ObjCPropertyDecl;
   class ClassTemplateDecl;
   class FunctionTemplateDecl;
-  class Preprocessor;
   class TypeAliasTemplateDecl;
 
 namespace cxindex {