Ver código fonte

Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.

Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149781 91177308-0d34-0410-b5e6-96231b3b80d8
Benjamin Kramer 13 anos atrás
pai
commit
00bd44d567
38 arquivos alterados com 106 adições e 50 exclusões
  1. 0 1
      include/clang/AST/ASTContext.h
  2. 10 13
      include/clang/AST/Decl.h
  3. 5 14
      include/clang/AST/DeclarationName.h
  4. 2 0
      include/clang/AST/Mangle.h
  5. 4 7
      include/clang/AST/NestedNameSpecifier.h
  6. 3 14
      include/clang/AST/Type.h
  7. 1 0
      include/clang/Sema/CodeCompleteConsumer.h
  8. 1 0
      include/clang/Sema/DelayedDiagnostic.h
  9. 1 0
      include/clang/Sema/Sema.h
  10. 1 0
      include/clang/Sema/SemaFixItUtils.h
  11. 1 0
      include/clang/Serialization/ASTWriter.h
  12. 1 0
      lib/AST/ASTContext.cpp
  13. 15 0
      lib/AST/Decl.cpp
  14. 1 0
      lib/AST/DeclCXX.cpp
  15. 15 0
      lib/AST/DeclarationName.cpp
  16. 1 0
      lib/AST/ExprConstant.cpp
  17. 1 0
      lib/AST/ItaniumMangle.cpp
  18. 7 0
      lib/AST/NestedNameSpecifier.cpp
  19. 15 0
      lib/AST/Type.cpp
  20. 1 0
      lib/CodeGen/CGCXXABI.cpp
  21. 2 1
      lib/CodeGen/CGDebugInfo.cpp
  22. 1 0
      lib/CodeGen/CodeGenTBAA.cpp
  23. 1 0
      lib/Sema/AnalysisBasedWarnings.cpp
  24. 1 0
      lib/Serialization/ASTWriter.cpp
  25. 1 0
      lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
  26. 1 0
      lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
  27. 1 0
      lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  28. 1 0
      lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
  29. 1 0
      lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  30. 1 0
      lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
  31. 1 0
      lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
  32. 1 0
      lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  33. 1 0
      lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
  34. 1 0
      lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
  35. 1 0
      lib/StaticAnalyzer/Core/AnalysisManager.cpp
  36. 1 0
      lib/StaticAnalyzer/Core/BugReporter.cpp
  37. 1 0
      lib/StaticAnalyzer/Core/CheckerRegistry.cpp
  38. 2 0
      tools/libclang/IndexingContext.h

+ 0 - 1
include/clang/AST/ASTContext.h

@@ -18,7 +18,6 @@
 #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"

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

@@ -41,7 +41,11 @@ 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:
@@ -3175,18 +3179,11 @@ 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 <<.
-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;
-}
+const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                    const NamedDecl* ND);
+
+const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+                                    const NamedDecl* ND);
 
 
 template<typename decl_type>
 template<typename decl_type>
 void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {
 void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {

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

@@ -16,7 +16,6 @@
 #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;
@@ -517,24 +516,16 @@ 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 <<.
-inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                           DeclarationName N) {
-  DB.AddTaggedVal(N.getAsOpaqueInteger(),
-                  DiagnosticsEngine::ak_declarationname);
-  return DB;
-}
+const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                    DeclarationName N);
 
 
 /// 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 <<.
-inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
-                                           DeclarationName N) {
-  PD.AddTaggedVal(N.getAsOpaqueInteger(),
-                  DiagnosticsEngine::ak_declarationname);
-  return PD;
-}
+const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+                                    DeclarationName N);
 
 
 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;
 }
 }

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

@@ -27,6 +27,8 @@ 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;

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

@@ -14,13 +14,14 @@
 #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/Diagnostic.h"
+#include "clang/Basic/SourceLocation.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;
@@ -464,12 +465,8 @@ 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 <<.
-inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                           NestedNameSpecifier *NNS) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(NNS),
-                  DiagnosticsEngine::ak_nestednamespec);
-  return DB;
-}
+const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                    NestedNameSpecifier *NNS);
 
 
 }
 }
 
 

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

@@ -14,11 +14,9 @@
 #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"
@@ -94,6 +92,7 @@ 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;
@@ -4799,21 +4798,11 @@ 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 <<.
-inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                           QualType T) {
-  DB.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
-                  DiagnosticsEngine::ak_qualtype);
-  return DB;
-}
+const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, QualType T);
 
 
 /// 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 <<.
-inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
-                                           QualType T) {
-  PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
-                  DiagnosticsEngine::ak_qualtype);
-  return PD;
-}
+const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, QualType T);
 
 
 // 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.

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

@@ -24,6 +24,7 @@
 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.

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

@@ -22,6 +22,7 @@
 #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 {

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

@@ -30,6 +30,7 @@
 #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"

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

@@ -14,6 +14,7 @@
 #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 {
 
 

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

@@ -43,6 +43,7 @@ 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;

+ 1 - 0
lib/AST/ASTContext.cpp

@@ -24,6 +24,7 @@
 #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"

+ 15 - 0
lib/AST/Decl.cpp

@@ -25,6 +25,7 @@
 #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"
@@ -2959,3 +2960,17 @@ 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;
+}

+ 1 - 0
lib/AST/DeclCXX.cpp

@@ -20,6 +20,7 @@
 #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;

+ 15 - 0
lib/AST/DeclarationName.cpp

@@ -18,6 +18,7 @@
 #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"
@@ -620,3 +621,17 @@ 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;
+}

+ 1 - 0
lib/AST/ExprConstant.cpp

@@ -42,6 +42,7 @@
 #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>

+ 1 - 0
lib/AST/ItaniumMangle.cpp

@@ -24,6 +24,7 @@
 #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"

+ 7 - 0
lib/AST/NestedNameSpecifier.cpp

@@ -18,6 +18,7 @@
 #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>
 
 
@@ -639,3 +640,9 @@ 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;
+}

+ 15 - 0
lib/AST/Type.cpp

@@ -20,6 +20,7 @@
 #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"
@@ -2309,3 +2310,17 @@ 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;
+}

+ 1 - 0
lib/CodeGen/CGCXXABI.cpp

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

+ 2 - 1
lib/CodeGen/CGDebugInfo.cpp

@@ -21,8 +21,9 @@
 #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/SourceManager.h"
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/SourceManager.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"

+ 1 - 0
lib/CodeGen/CodeGenTBAA.cpp

@@ -22,6 +22,7 @@
 #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;
 
 

+ 1 - 0
lib/Sema/AnalysisBasedWarnings.cpp

@@ -16,6 +16,7 @@
 #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"

+ 1 - 0
lib/Serialization/ASTWriter.cpp

@@ -29,6 +29,7 @@
 #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"

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

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

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

@@ -17,6 +17,7 @@
 #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;

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

@@ -18,6 +18,7 @@
 #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 "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/StringSwitch.h"
 
 
 using namespace clang;
 using namespace clang;

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

@@ -17,6 +17,7 @@
 #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;

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

@@ -21,6 +21,7 @@
 #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;
 
 

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

@@ -20,6 +20,7 @@
 #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;

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

@@ -19,6 +19,7 @@
 #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;

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

@@ -20,6 +20,7 @@
 #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;

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

@@ -19,6 +19,7 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/StringSwitch.h"
 #include <fcntl.h>
 #include <fcntl.h>
 
 

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

@@ -20,6 +20,7 @@
 #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 "clang/AST/CharUnits.h"
 #include "clang/AST/CharUnits.h"
+#include "llvm/ADT/STLExtras.h"
 
 
 using namespace clang;
 using namespace clang;
 using namespace ento;
 using namespace ento;

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

@@ -10,6 +10,7 @@
 #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;

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

@@ -21,6 +21,7 @@
 #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"

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

@@ -10,6 +10,7 @@
 #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;

+ 2 - 0
tools/libclang/IndexingContext.h

@@ -13,12 +13,14 @@
 #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 {