Bladeren bron

Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

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
Benjamin Kramer 13 jaren geleden
bovenliggende
commit
d7a3e2c5f6
46 gewijzigde bestanden met toevoegingen van 159 en 224 verwijderingen
  1. 4 4
      include/clang/AST/ASTContext.h
  2. 5 1
      include/clang/AST/CanonicalType.h
  3. 13 10
      include/clang/AST/Decl.h
  4. 14 5
      include/clang/AST/DeclarationName.h
  5. 0 2
      include/clang/AST/Mangle.h
  6. 7 4
      include/clang/AST/NestedNameSpecifier.h
  7. 14 3
      include/clang/AST/Type.h
  8. 0 1
      include/clang/Basic/Diagnostic.h
  9. 77 73
      include/clang/Basic/PartialDiagnostic.h
  10. 4 4
      include/clang/Lex/PPCallbacks.h
  11. 1 0
      include/clang/Lex/PTHManager.h
  12. 14 4
      include/clang/Lex/Preprocessor.h
  13. 0 1
      include/clang/Sema/CodeCompleteConsumer.h
  14. 0 1
      include/clang/Sema/DelayedDiagnostic.h
  15. 0 1
      include/clang/Sema/Sema.h
  16. 0 1
      include/clang/Sema/SemaFixItUtils.h
  17. 0 1
      include/clang/Serialization/ASTWriter.h
  18. 0 7
      lib/AST/ASTContext.cpp
  19. 0 15
      lib/AST/Decl.cpp
  20. 0 1
      lib/AST/DeclCXX.cpp
  21. 0 15
      lib/AST/DeclarationName.cpp
  22. 0 1
      lib/AST/ExprConstant.cpp
  23. 0 1
      lib/AST/ItaniumMangle.cpp
  24. 0 7
      lib/AST/NestedNameSpecifier.cpp
  25. 0 21
      lib/AST/Type.cpp
  26. 2 2
      lib/Basic/Diagnostic.cpp
  27. 0 1
      lib/CodeGen/CGCXXABI.cpp
  28. 1 2
      lib/CodeGen/CGDebugInfo.cpp
  29. 0 1
      lib/CodeGen/CodeGenTBAA.cpp
  30. 3 3
      lib/Frontend/PrintPreprocessedOutput.cpp
  31. 0 15
      lib/Lex/Preprocessor.cpp
  32. 0 1
      lib/Rewrite/HTMLRewrite.cpp
  33. 0 1
      lib/Sema/AnalysisBasedWarnings.cpp
  34. 0 1
      lib/Serialization/ASTWriter.cpp
  35. 0 1
      lib/Serialization/GeneratePCH.cpp
  36. 0 1
      lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
  37. 0 1
      lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
  38. 0 1
      lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
  39. 0 1
      lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
  40. 0 1
      lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  41. 0 1
      lib/StaticAnalyzer/Core/AnalysisManager.cpp
  42. 0 1
      lib/StaticAnalyzer/Core/BugReporter.cpp
  43. 0 1
      lib/StaticAnalyzer/Core/CheckerRegistry.cpp
  44. 0 1
      lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
  45. 0 1
      lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  46. 0 2
      tools/libclang/IndexingContext.h

+ 4 - 4
include/clang/AST/ASTContext.h

@@ -18,6 +18,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/OperatorKinds.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/VersionTuple.h"
 #include "clang/Basic/VersionTuple.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/NestedNameSpecifier.h"
@@ -48,7 +49,6 @@ namespace clang {
   class ExternalASTSource;
   class ExternalASTSource;
   class ASTMutationListener;
   class ASTMutationListener;
   class IdentifierTable;
   class IdentifierTable;
-  class PartialDiagnosticStorageAllocator;
   class SelectorTable;
   class SelectorTable;
   class SourceManager;
   class SourceManager;
   class TargetInfo;
   class TargetInfo;
@@ -346,7 +346,7 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> {
   mutable llvm::BumpPtrAllocator BumpAlloc;
   mutable llvm::BumpPtrAllocator BumpAlloc;
 
 
   /// \brief Allocator for partial diagnostics.
   /// \brief Allocator for partial diagnostics.
-  PartialDiagnosticStorageAllocator *DiagAllocator;
+  PartialDiagnostic::StorageAllocator DiagAllocator;
 
 
   /// \brief The current C++ ABI.
   /// \brief The current C++ ABI.
   OwningPtr<CXXABI> ABI;
   OwningPtr<CXXABI> ABI;
@@ -391,8 +391,8 @@ public:
   /// Return the total memory used for various side tables.
   /// Return the total memory used for various side tables.
   size_t getSideTableAllocatedMemory() const;
   size_t getSideTableAllocatedMemory() const;
   
   
-  PartialDiagnosticStorageAllocator &getDiagAllocator() {
-    return *DiagAllocator;
+  PartialDiagnostic::StorageAllocator &getDiagAllocator() {
+    return DiagAllocator;
   }
   }
 
 
   const TargetInfo &getTargetInfo() const { return *Target; }
   const TargetInfo &getTargetInfo() const { return *Target; }

+ 5 - 1
include/clang/AST/CanonicalType.h

@@ -200,7 +200,11 @@ inline CanQualType Type::getCanonicalTypeUnqualified() const {
   return CanQualType::CreateUnsafe(getCanonicalTypeInternal());
   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
 // Internal proxy classes used by canonical types

+ 13 - 10
include/clang/AST/Decl.h

@@ -41,11 +41,7 @@ class TypeLoc;
 class UnresolvedSetImpl;
 class UnresolvedSetImpl;
 class LabelStmt;
 class LabelStmt;
 class Module;
 class Module;
-
-// Forward declare PartialDiagnosticAt.
-// FIXME: This shouldn't be here.
-typedef std::pair<SourceLocation, PartialDiagnostic> PartialDiagnosticAt;
-
+  
 /// \brief A container of type source information.
 /// \brief A container of type source information.
 ///
 ///
 /// A client can read the relevant info using TypeLoc wrappers, e.g:
 /// 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
 /// Insertion operator for diagnostics.  This allows sending NamedDecl's
 /// into a diagnostic with <<.
 /// 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>
 template<typename decl_type>
 void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {
 void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {

+ 14 - 5
include/clang/AST/DeclarationName.h

@@ -16,6 +16,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/CanonicalType.h"
 #include "clang/AST/CanonicalType.h"
+#include "clang/Basic/PartialDiagnostic.h"
 
 
 namespace llvm {
 namespace llvm {
   template <typename T> struct DenseMapInfo;
   template <typename T> struct DenseMapInfo;
@@ -516,16 +517,24 @@ public:
 
 
 /// Insertion operator for diagnostics.  This allows sending DeclarationName's
 /// Insertion operator for diagnostics.  This allows sending DeclarationName's
 /// into a diagnostic with <<.
 /// 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
 /// Insertion operator for partial diagnostics.  This allows binding
 /// DeclarationName's into a partial diagnostic with <<.
 /// 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,
 inline raw_ostream &operator<<(raw_ostream &OS,
-                               DeclarationNameInfo DNInfo) {
+                                     DeclarationNameInfo DNInfo) {
   DNInfo.printName(OS);
   DNInfo.printName(OS);
   return OS;
   return OS;
 }
 }

+ 0 - 2
include/clang/AST/Mangle.h

@@ -27,8 +27,6 @@ namespace clang {
   class CXXConstructorDecl;
   class CXXConstructorDecl;
   class CXXDestructorDecl;
   class CXXDestructorDecl;
   class CXXMethodDecl;
   class CXXMethodDecl;
-  class DeclContext;
-  class DiagnosticsEngine;
   class FunctionDecl;
   class FunctionDecl;
   class NamedDecl;
   class NamedDecl;
   class ObjCMethodDecl;
   class ObjCMethodDecl;

+ 7 - 4
include/clang/AST/NestedNameSpecifier.h

@@ -14,14 +14,13 @@
 #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
 #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
 #define 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/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerIntPair.h"
 
 
 namespace clang {
 namespace clang {
 
 
 class ASTContext;
 class ASTContext;
-class DiagnosticBuilder;
 class NamespaceAliasDecl;
 class NamespaceAliasDecl;
 class NamespaceDecl;
 class NamespaceDecl;
 class IdentifierInfo;
 class IdentifierInfo;
@@ -465,8 +464,12 @@ public:
 
 
 /// Insertion operator for diagnostics.  This allows sending
 /// Insertion operator for diagnostics.  This allows sending
 /// NestedNameSpecifiers into a diagnostic with <<.
 /// 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;
+}
 
 
 }
 }
 
 

+ 14 - 3
include/clang/AST/Type.h

@@ -14,9 +14,11 @@
 #ifndef LLVM_CLANG_AST_TYPE_H
 #ifndef LLVM_CLANG_AST_TYPE_H
 #define LLVM_CLANG_AST_TYPE_H
 #define LLVM_CLANG_AST_TYPE_H
 
 
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/Linkage.h"
 #include "clang/Basic/Linkage.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Visibility.h"
 #include "clang/Basic/Visibility.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/TemplateName.h"
@@ -92,7 +94,6 @@ namespace clang {
   class ExtQuals;
   class ExtQuals;
   class ExtQualsTypeCommonBase;
   class ExtQualsTypeCommonBase;
   struct PrintingPolicy;
   struct PrintingPolicy;
-  class PartialDiagnostic;
 
 
   template <typename> class CanQual;
   template <typename> class CanQual;
   typedef CanQual<Type> CanQualType;
   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
 /// Insertion operator for diagnostics.  This allows sending QualType's into a
 /// diagnostic with <<.
 /// 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
 /// Insertion operator for partial diagnostics.  This allows sending QualType's
 /// into a diagnostic with <<.
 /// 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
 // 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.
 // not try to look through a qualified type to get to an array type.

+ 0 - 1
include/clang/Basic/Diagnostic.h

@@ -601,7 +601,6 @@ private:
   friend class DiagnosticBuilder;
   friend class DiagnosticBuilder;
   friend class Diagnostic;
   friend class Diagnostic;
   friend class PartialDiagnostic;
   friend class PartialDiagnostic;
-  friend struct PartialDiagnosticStorage;
   friend class DiagnosticErrorTrap;
   friend class DiagnosticErrorTrap;
   
   
   /// CurDiagLoc - This is the location of the current diagnostic that is in
   /// CurDiagLoc - This is the location of the current diagnostic that is in

+ 77 - 73
include/clang/Basic/PartialDiagnostic.h

@@ -23,87 +23,91 @@
 
 
 namespace clang {
 namespace clang {
 
 
-struct PartialDiagnosticStorage {
-  PartialDiagnosticStorage() : NumDiagArgs(0), NumDiagRanges(0) { }
-
+class PartialDiagnostic {
+public:
   enum {
   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
       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:
 private:
   // NOTE: Sema assumes that PartialDiagnostic is location-invariant
   // NOTE: Sema assumes that PartialDiagnostic is location-invariant

+ 4 - 4
include/clang/Lex/PPCallbacks.h

@@ -16,6 +16,7 @@
 
 
 #include "clang/Lex/DirectoryLookup.h"
 #include "clang/Lex/DirectoryLookup.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/DiagnosticIDs.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
 #include <string>
 
 
@@ -157,10 +158,9 @@ public:
   }
   }
 
 
   /// PragmaDiagnostic - This callback is invoked when a
   /// 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,
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                unsigned mapping, StringRef Str) {
+                                diag::Mapping mapping, StringRef Str) {
   }
   }
 
 
   /// MacroExpands - This is called by
   /// MacroExpands - This is called by
@@ -303,7 +303,7 @@ public:
   }
   }
 
 
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
   virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                                unsigned mapping, StringRef Str) {
+                                diag::Mapping mapping, StringRef Str) {
     First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
     First->PragmaDiagnostic(Loc, Namespace, mapping, Str);
     Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
     Second->PragmaDiagnostic(Loc, Namespace, mapping, Str);
   }
   }

+ 1 - 0
include/clang/Lex/PTHManager.h

@@ -17,6 +17,7 @@
 #include "clang/Lex/PTHLexer.h"
 #include "clang/Lex/PTHLexer.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/Diagnostic.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Allocator.h"
 #include <string>
 #include <string>

+ 14 - 4
include/clang/Lex/Preprocessor.h

@@ -21,6 +21,7 @@
 #include "clang/Lex/TokenLexer.h"
 #include "clang/Lex/TokenLexer.h"
 #include "clang/Lex/PTHManager.h"
 #include "clang/Lex/PTHManager.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/Builtins.h"
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMap.h"
@@ -60,7 +61,7 @@ class ModuleLoader;
 /// like the #include stack, token expansion, etc.
 /// like the #include stack, token expansion, etc.
 ///
 ///
 class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
 class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
-  DiagnosticsEngine *Diags;
+  DiagnosticsEngine        *Diags;
   LangOptions       &Features;
   LangOptions       &Features;
   const TargetInfo  *Target;
   const TargetInfo  *Target;
   FileManager       &FileMgr;
   FileManager       &FileMgr;
@@ -728,7 +729,12 @@ public:
   bool isCodeCompletionReached() const { return CodeCompletionReached; }
   bool isCodeCompletionReached() const { return CodeCompletionReached; }
 
 
   /// \brief Note that we hit the code-completion point.
   /// \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
   /// \brief The location of the currently-active #pragma clang
   /// arc_cf_code_audited begin.  Returns an invalid location if there
   /// 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
   /// Diag - Forwarding function for diagnostics.  This emits a diagnostic at
   /// the specified Token's location, translating the token's start
   /// the specified Token's location, translating the token's start
   /// position in the current buffer into a SourcePosition object for rendering.
   /// 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
   /// getSpelling() - Return the 'spelling' of the token at the given
   /// location; does not go up to the spelling location or down to the
   /// location; does not go up to the spelling location or down to the

+ 0 - 1
include/clang/Sema/CodeCompleteConsumer.h

@@ -24,7 +24,6 @@
 namespace clang {
 namespace clang {
 
 
 class Decl;
 class Decl;
-class Preprocessor;
 
 
 /// \brief Default priority values for code-completion results based
 /// \brief Default priority values for code-completion results based
 /// on their kind.
 /// on their kind.

+ 0 - 1
include/clang/Sema/DelayedDiagnostic.h

@@ -22,7 +22,6 @@
 #define LLVM_CLANG_SEMA_DELAYED_DIAGNOSTIC_H
 #define LLVM_CLANG_SEMA_DELAYED_DIAGNOSTIC_H
 
 
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclCXX.h"
-#include "clang/Basic/PartialDiagnostic.h"
 
 
 namespace clang {
 namespace clang {
 namespace sema {
 namespace sema {

+ 0 - 1
include/clang/Sema/Sema.h

@@ -30,7 +30,6 @@
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/ModuleLoader.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TemplateKinds.h"
 #include "clang/Basic/TemplateKinds.h"
 #include "clang/Basic/TypeTraits.h"
 #include "clang/Basic/TypeTraits.h"

+ 0 - 1
include/clang/Sema/SemaFixItUtils.h

@@ -14,7 +14,6 @@
 #define LLVM_CLANG_SEMA_FIXITUTILS_H
 #define LLVM_CLANG_SEMA_FIXITUTILS_H
 
 
 #include "clang/AST/Expr.h"
 #include "clang/AST/Expr.h"
-#include "clang/Basic/Diagnostic.h"
 
 
 namespace clang {
 namespace clang {
 
 

+ 0 - 1
include/clang/Serialization/ASTWriter.h

@@ -43,7 +43,6 @@ class ASTContext;
 class NestedNameSpecifier;
 class NestedNameSpecifier;
 class CXXBaseSpecifier;
 class CXXBaseSpecifier;
 class CXXCtorInitializer;
 class CXXCtorInitializer;
-class DiagnosticsEngine;
 class FPOptions;
 class FPOptions;
 class HeaderSearch;
 class HeaderSearch;
 class IdentifierResolver;
 class IdentifierResolver;

+ 0 - 7
lib/AST/ASTContext.cpp

@@ -24,7 +24,6 @@
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/Mangle.h"
 #include "clang/AST/Mangle.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallString.h"
@@ -242,9 +241,6 @@ ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM,
     LastSDM(0, 0),
     LastSDM(0, 0),
     UniqueBlockByRefTypeID(0) 
     UniqueBlockByRefTypeID(0) 
 {
 {
-  // Create a new allocator for partial diagnostics.
-  DiagAllocator = new (BumpAlloc) PartialDiagnosticStorageAllocator;
-
   if (size_reserve > 0) Types.reserve(size_reserve);
   if (size_reserve > 0) Types.reserve(size_reserve);
   TUDecl = TranslationUnitDecl::Create(*this);
   TUDecl = TranslationUnitDecl::Create(*this);
   
   
@@ -289,9 +285,6 @@ ASTContext::~ASTContext() {
                                                     AEnd = DeclAttrs.end();
                                                     AEnd = DeclAttrs.end();
        A != AEnd; ++A)
        A != AEnd; ++A)
     A->second->~AttrVec();
     A->second->~AttrVec();
-
-  // Destroy the partial diagnostic allocator.
-  DiagAllocator->~PartialDiagnosticStorageAllocator();
 }
 }
 
 
 void ASTContext::AddDeallocation(void (*Callback)(void*), void *Data) {
 void ASTContext::AddDeallocation(void (*Callback)(void*), void *Data) {

+ 0 - 15
lib/AST/Decl.cpp

@@ -25,7 +25,6 @@
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/Module.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -3002,17 +3001,3 @@ SourceRange ImportDecl::getSourceRange() const {
   
   
   return SourceRange(getLocation(), getIdentifierLocs().back());
   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;
-}

+ 0 - 1
lib/AST/DeclCXX.cpp

@@ -20,7 +20,6 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallPtrSet.h"
 using namespace clang;
 using namespace clang;

+ 0 - 15
lib/AST/DeclarationName.cpp

@@ -18,7 +18,6 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -621,17 +620,3 @@ SourceLocation DeclarationNameInfo::getEndLoc() const {
   }
   }
   llvm_unreachable("Unexpected declaration name kind");
   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;
-}

+ 0 - 1
lib/AST/ExprConstant.cpp

@@ -42,7 +42,6 @@
 #include "clang/AST/ASTDiagnostic.h"
 #include "clang/AST/ASTDiagnostic.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/Expr.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallString.h"
 #include <cstring>
 #include <cstring>

+ 0 - 1
lib/AST/ItaniumMangle.cpp

@@ -24,7 +24,6 @@
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/ABI.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringExtras.h"

+ 0 - 7
lib/AST/NestedNameSpecifier.cpp

@@ -18,7 +18,6 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLoc.h"
-#include "clang/Basic/Diagnostic.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cassert>
 
 
@@ -640,9 +639,3 @@ NestedNameSpecifierLocBuilder::getWithLocInContext(ASTContext &Context) const {
   return NestedNameSpecifierLoc(Representation, Mem);
   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;
-}

+ 0 - 21
lib/AST/Type.cpp

@@ -20,7 +20,6 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/TypeVisitor.h"
 #include "clang/AST/TypeVisitor.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Specifiers.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringExtras.h"
@@ -2310,23 +2309,3 @@ bool QualType::hasTrivialAssignment(ASTContext &Context, bool Copying) const {
   
   
   return true;
   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;
-}

+ 2 - 2
lib/Basic/Diagnostic.cpp

@@ -877,13 +877,13 @@ bool DiagnosticConsumer::IncludeInDiagnosticCounts() const { return true; }
 
 
 void IgnoringDiagConsumer::anchor() { }
 void IgnoringDiagConsumer::anchor() { }
 
 
-PartialDiagnosticStorageAllocator::PartialDiagnosticStorageAllocator() {
+PartialDiagnostic::StorageAllocator::StorageAllocator() {
   for (unsigned I = 0; I != NumCached; ++I)
   for (unsigned I = 0; I != NumCached; ++I)
     FreeList[I] = Cached + I;
     FreeList[I] = Cached + I;
   NumFreeListEntries = NumCached;
   NumFreeListEntries = NumCached;
 }
 }
 
 
-PartialDiagnosticStorageAllocator::~PartialDiagnosticStorageAllocator() {
+PartialDiagnostic::StorageAllocator::~StorageAllocator() {
   // Don't assert if we are in a CrashRecovery context, as this
   // Don't assert if we are in a CrashRecovery context, as this
   // invariant may be invalidated during a crash.
   // invariant may be invalidated during a crash.
   assert((NumFreeListEntries == NumCached || llvm::CrashRecoveryContext::isRecoveringFromCrash()) && "A partial is on the lamb");
   assert((NumFreeListEntries == NumCached || llvm::CrashRecoveryContext::isRecoveringFromCrash()) && "A partial is on the lamb");

+ 0 - 1
lib/CodeGen/CGCXXABI.cpp

@@ -13,7 +13,6 @@
 //===----------------------------------------------------------------------===//
 //===----------------------------------------------------------------------===//
 
 
 #include "CGCXXABI.h"
 #include "CGCXXABI.h"
-#include "clang/Basic/Diagnostic.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace CodeGen;
 using namespace CodeGen;

+ 1 - 2
lib/CodeGen/CGDebugInfo.cpp

@@ -21,9 +21,8 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/RecordLayout.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/FileManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Basic/Version.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/Constants.h"
 #include "llvm/Constants.h"

+ 0 - 1
lib/CodeGen/CodeGenTBAA.cpp

@@ -22,7 +22,6 @@
 #include "llvm/Metadata.h"
 #include "llvm/Metadata.h"
 #include "llvm/Constants.h"
 #include "llvm/Constants.h"
 #include "llvm/Type.h"
 #include "llvm/Type.h"
-#include "llvm/ADT/STLExtras.h"
 using namespace clang;
 using namespace clang;
 using namespace CodeGen;
 using namespace CodeGen;
 
 

+ 3 - 3
lib/Frontend/PrintPreprocessedOutput.cpp

@@ -128,7 +128,7 @@ public:
   virtual void PragmaDiagnosticPop(SourceLocation Loc,
   virtual void PragmaDiagnosticPop(SourceLocation Loc,
                                    StringRef Namespace);
                                    StringRef Namespace);
   virtual void PragmaDiagnostic(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 HandleFirstTokOnLine(Token &Tok);
   bool MoveToLine(SourceLocation Loc) {
   bool MoveToLine(SourceLocation Loc) {
@@ -385,10 +385,10 @@ PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) {
 
 
 void PrintPPOutputPPCallbacks::
 void PrintPPOutputPPCallbacks::
 PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
 PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
-                 unsigned Map, StringRef Str) {
+                 diag::Mapping Map, StringRef Str) {
   MoveToLine(Loc);
   MoveToLine(Loc);
   OS << "#pragma " << Namespace << " diagnostic ";
   OS << "#pragma " << Namespace << " diagnostic ";
-  switch ((diag::Mapping)Map) {
+  switch (Map) {
   case diag::MAP_WARNING:
   case diag::MAP_WARNING:
     OS << "warning";
     OS << "warning";
     break;
     break;

+ 0 - 15
lib/Lex/Preprocessor.cpp

@@ -336,21 +336,6 @@ void Preprocessor::CodeCompleteNaturalLanguage() {
   setCodeCompletionReached();
   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
 /// 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
 /// SmallVector. Note that the returned StringRef may not point to the
 /// supplied buffer if a copy can be avoided.
 /// supplied buffer if a copy can be avoided.

+ 0 - 1
lib/Rewrite/HTMLRewrite.cpp

@@ -17,7 +17,6 @@
 #include "clang/Rewrite/HTMLRewrite.h"
 #include "clang/Rewrite/HTMLRewrite.h"
 #include "clang/Lex/TokenConcatenation.h"
 #include "clang/Lex/TokenConcatenation.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Preprocessor.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/OwningPtr.h"

+ 0 - 1
lib/Sema/AnalysisBasedWarnings.cpp

@@ -16,7 +16,6 @@
 #include "clang/Sema/AnalysisBasedWarnings.h"
 #include "clang/Sema/AnalysisBasedWarnings.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Sema/SemaInternal.h"
 #include "clang/Sema/ScopeInfo.h"
 #include "clang/Sema/ScopeInfo.h"
-#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Preprocessor.h"

+ 0 - 1
lib/Serialization/ASTWriter.cpp

@@ -29,7 +29,6 @@
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/HeaderSearch.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "clang/Basic/OnDiskHashTable.h"
 #include "clang/Basic/OnDiskHashTable.h"

+ 0 - 1
lib/Serialization/GeneratePCH.cpp

@@ -17,7 +17,6 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Preprocessor.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "llvm/Bitcode/BitstreamWriter.h"
 #include "llvm/Bitcode/BitstreamWriter.h"

+ 0 - 1
lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp

@@ -17,7 +17,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp

@@ -17,7 +17,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp

@@ -20,7 +20,6 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Checkers/DereferenceChecker.h"
 #include "clang/StaticAnalyzer/Checkers/DereferenceChecker.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp

@@ -19,7 +19,6 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/ImmutableList.h"
 #include "llvm/ADT/ImmutableList.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Checkers/StreamChecker.cpp

@@ -20,7 +20,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/ImmutableMap.h"
 #include "llvm/ADT/ImmutableMap.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Core/AnalysisManager.cpp

@@ -10,7 +10,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/Index/Entity.h"
 #include "clang/Index/Entity.h"
 #include "clang/Index/Indexer.h"
 #include "clang/Index/Indexer.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Core/BugReporter.cpp

@@ -21,7 +21,6 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ParentMap.h"
 #include "clang/AST/ParentMap.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtObjC.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"

+ 0 - 1
lib/StaticAnalyzer/Core/CheckerRegistry.cpp

@@ -10,7 +10,6 @@
 #include "clang/StaticAnalyzer/Core/CheckerRegistry.h"
 #include "clang/StaticAnalyzer/Core/CheckerRegistry.h"
 #include "clang/StaticAnalyzer/Core/CheckerOptInfo.h"
 #include "clang/StaticAnalyzer/Core/CheckerOptInfo.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

+ 0 - 1
lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp

@@ -13,7 +13,6 @@
 
 
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 using namespace clang;

+ 0 - 1
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

@@ -27,7 +27,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 
 
-#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/AnalyzerOptions.h"
 #include "clang/Frontend/AnalyzerOptions.h"

+ 0 - 2
tools/libclang/IndexingContext.h

@@ -13,14 +13,12 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclGroup.h"
 #include "clang/AST/DeclGroup.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
 
 
 namespace clang {
 namespace clang {
   class FileEntry;
   class FileEntry;
   class ObjCPropertyDecl;
   class ObjCPropertyDecl;
   class ClassTemplateDecl;
   class ClassTemplateDecl;
   class FunctionTemplateDecl;
   class FunctionTemplateDecl;
-  class Preprocessor;
   class TypeAliasTemplateDecl;
   class TypeAliasTemplateDecl;
 
 
 namespace cxindex {
 namespace cxindex {