From d7d2b1fe455d9726d8f34b8605fc761650f3bd8d Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 1 Dec 2012 16:35:25 +0000 Subject: [PATCH] Don't include Type.h in DeclarationName.h. Recursively prune some includes. llvm-svn: 169094 --- clang/include/clang/AST/Decl.h | 23 +++++++------- clang/include/clang/AST/DeclBase.h | 37 +++++++++++----------- clang/include/clang/AST/DeclarationName.h | 28 +++++++--------- clang/include/clang/AST/Expr.h | 18 +++++------ clang/include/clang/AST/ExternalASTSource.h | 2 ++ .../Core/PathSensitive/SValBuilder.h | 1 - clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp | 1 + clang/lib/ARCMigrate/Transforms.cpp | 3 +- clang/lib/AST/DeclarationName.cpp | 15 +++++++++ clang/lib/Parse/ParseDecl.cpp | 1 + clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp | 1 + .../Checkers/ExprInspectionChecker.cpp | 1 + .../Checkers/StackAddrEscapeChecker.cpp | 1 + clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 1 + 14 files changed, 77 insertions(+), 56 deletions(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index d61e6dd..a8ce7df 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -16,33 +16,34 @@ #include "clang/AST/APValue.h" #include "clang/AST/DeclBase.h" -#include "clang/AST/Redeclarable.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/ExternalASTSource.h" +#include "clang/AST/Redeclarable.h" +#include "clang/AST/Type.h" #include "clang/Basic/Linkage.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/Compiler.h" namespace clang { +struct ASTTemplateArgumentListInfo; class CXXTemporary; +class CompoundStmt; +class DependentFunctionTemplateSpecializationInfo; class Expr; class FunctionTemplateDecl; +class FunctionTemplateSpecializationInfo; +class LabelStmt; +class MemberSpecializationInfo; +class Module; +class NestedNameSpecifier; class Stmt; -class CompoundStmt; class StringLiteral; -class NestedNameSpecifier; -class TemplateParameterList; class TemplateArgumentList; -struct ASTTemplateArgumentListInfo; -class MemberSpecializationInfo; -class FunctionTemplateSpecializationInfo; -class DependentFunctionTemplateSpecializationInfo; +class TemplateParameterList; class TypeLoc; class UnresolvedSetImpl; -class LabelStmt; -class Module; - + /// \brief A container of type source information. /// /// A client can read the relevant info using TypeLoc wrappers, e.g: diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 7865566..c5b1a09 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -16,36 +16,37 @@ #include "clang/AST/AttrIterator.h" #include "clang/AST/DeclarationName.h" -#include "clang/AST/Type.h" #include "clang/Basic/Specifiers.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/PrettyStackTrace.h" namespace clang { -class DeclContext; -class TranslationUnitDecl; -class NamespaceDecl; -class UsingDirectiveDecl; -class NamedDecl; -class FunctionDecl; +class ASTMutationListener; +class BlockDecl; class CXXRecordDecl; +class CompoundStmt; +class DeclContext; +class DeclarationName; +class DependentDiagnostic; class EnumDecl; -class ObjCMethodDecl; -class ObjCContainerDecl; -class ObjCInterfaceDecl; +class FunctionDecl; +class LinkageSpecDecl; +class NamedDecl; +class NamespaceDecl; class ObjCCategoryDecl; -class ObjCProtocolDecl; -class ObjCImplementationDecl; class ObjCCategoryImplDecl; +class ObjCContainerDecl; class ObjCImplDecl; -class LinkageSpecDecl; -class BlockDecl; -class DeclarationName; -class CompoundStmt; +class ObjCImplementationDecl; +class ObjCInterfaceDecl; +class ObjCMethodDecl; +class ObjCProtocolDecl; +struct PrintingPolicy; +class Stmt; class StoredDeclsMap; -class DependentDiagnostic; -class ASTMutationListener; +class TranslationUnitDecl; +class UsingDirectiveDecl; } namespace llvm { diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h index d991c73..cf960bf 100644 --- a/clang/include/clang/AST/DeclarationName.h +++ b/clang/include/clang/AST/DeclarationName.h @@ -14,8 +14,6 @@ #define LLVM_CLANG_AST_DECLARATIONNAME_H #include "clang/Basic/IdentifierTable.h" -#include "clang/AST/Type.h" -#include "clang/AST/CanonicalType.h" #include "clang/Basic/PartialDiagnostic.h" #include "llvm/Support/Compiler.h" @@ -24,14 +22,20 @@ namespace llvm { } namespace clang { - class CXXSpecialName; - class CXXOperatorIdName; + class ASTContext; class CXXLiteralOperatorIdName; + class CXXOperatorIdName; + class CXXSpecialName; class DeclarationNameExtra; class IdentifierInfo; class MultiKeywordSelector; - class UsingDirectiveDecl; + class QualType; + class Type; class TypeSourceInfo; + class UsingDirectiveDecl; + + template class CanQual; + typedef CanQual CanQualType; /// DeclarationName - The name of a declaration. In the common case, /// this just stores an IdentifierInfo pointer to a normal @@ -349,23 +353,15 @@ public: /// getCXXConstructorName - Returns the name of a C++ constructor /// for the given Type. - DeclarationName getCXXConstructorName(CanQualType Ty) { - return getCXXSpecialName(DeclarationName::CXXConstructorName, - Ty.getUnqualifiedType()); - } + DeclarationName getCXXConstructorName(CanQualType Ty); /// getCXXDestructorName - Returns the name of a C++ destructor /// for the given Type. - DeclarationName getCXXDestructorName(CanQualType Ty) { - return getCXXSpecialName(DeclarationName::CXXDestructorName, - Ty.getUnqualifiedType()); - } + DeclarationName getCXXDestructorName(CanQualType Ty); /// getCXXConversionFunctionName - Returns the name of a C++ /// conversion function for the given Type. - DeclarationName getCXXConversionFunctionName(CanQualType Ty) { - return getCXXSpecialName(DeclarationName::CXXConversionFunctionName, Ty); - } + DeclarationName getCXXConversionFunctionName(CanQualType Ty); /// getCXXSpecialName - Returns a declaration name for special kind /// of C++ name, e.g., for a constructor, destructor, or conversion diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index ac35bf8..429a6e5 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -22,7 +22,6 @@ #include "clang/AST/OperationKinds.h" #include "clang/AST/ASTVector.h" #include "clang/AST/TemplateBase.h" -#include "clang/Basic/TargetInfo.h" #include "clang/Basic/TypeTraits.h" #include "llvm/ADT/APSInt.h" #include "llvm/ADT/APFloat.h" @@ -32,21 +31,22 @@ #include namespace clang { - class ASTContext; class APValue; - class CastExpr; - class Decl; - class IdentifierInfo; - class ParmVarDecl; - class NamedDecl; - class ValueDecl; + class ASTContext; class BlockDecl; class CXXBaseSpecifier; + class CXXMemberCallExpr; class CXXOperatorCallExpr; + class CastExpr; + class Decl; + class IdentifierInfo; class MaterializeTemporaryExpr; - class CXXMemberCallExpr; + class NamedDecl; class ObjCPropertyRefExpr; class OpaqueValueExpr; + class ParmVarDecl; + class TargetInfo; + class ValueDecl; /// \brief A simple array of base specifiers. typedef SmallVector CXXCastPath; diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h index db2bddb..826e95b 100644 --- a/clang/include/clang/AST/ExternalASTSource.h +++ b/clang/include/clang/AST/ExternalASTSource.h @@ -24,7 +24,9 @@ class ASTConsumer; class CXXBaseSpecifier; class DeclarationName; class ExternalSemaSource; // layering violation required for downcasting +class FieldDecl; class NamedDecl; +class RecordDecl; class Selector; class Stmt; class TagDecl; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h index 17c6b83..329dbf9 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h @@ -17,7 +17,6 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Expr.h" -#include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h" #include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h" diff --git a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp index dec4903..aa7e25b3 100644 --- a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -24,6 +24,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Lex/Lexer.h" #include "clang/Sema/SemaDiagnostic.h" +#include "llvm/ADT/StringSwitch.h" using namespace clang; using namespace arcmt; diff --git a/clang/lib/ARCMigrate/Transforms.cpp b/clang/lib/ARCMigrate/Transforms.cpp index 21f137e..7383e8d 100644 --- a/clang/lib/ARCMigrate/Transforms.cpp +++ b/clang/lib/ARCMigrate/Transforms.cpp @@ -14,11 +14,12 @@ #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/StmtVisitor.h" #include "clang/Basic/SourceManager.h" +#include "clang/Basic/TargetInfo.h" #include "clang/Lex/Lexer.h" #include "clang/Sema/Sema.h" #include "clang/Sema/SemaDiagnostic.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/StringSwitch.h" #include using namespace clang; diff --git a/clang/lib/AST/DeclarationName.cpp b/clang/lib/AST/DeclarationName.cpp index 28188d9..e4a41b6 100644 --- a/clang/lib/AST/DeclarationName.cpp +++ b/clang/lib/AST/DeclarationName.cpp @@ -364,6 +364,21 @@ DeclarationNameTable::~DeclarationNameTable() { delete LiteralNames; } +DeclarationName DeclarationNameTable::getCXXConstructorName(CanQualType Ty) { + return getCXXSpecialName(DeclarationName::CXXConstructorName, + Ty.getUnqualifiedType()); +} + +DeclarationName DeclarationNameTable::getCXXDestructorName(CanQualType Ty) { + return getCXXSpecialName(DeclarationName::CXXDestructorName, + Ty.getUnqualifiedType()); +} + +DeclarationName +DeclarationNameTable::getCXXConversionFunctionName(CanQualType Ty) { + return getCXXSpecialName(DeclarationName::CXXConversionFunctionName, Ty); +} + DeclarationName DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind, CanQualType Ty) { diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 23d1f40..9a8f800 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -13,6 +13,7 @@ #include "clang/Parse/Parser.h" #include "clang/Parse/ParseDiagnostic.h" +#include "clang/Basic/AddressSpaces.h" #include "clang/Basic/OpenCL.h" #include "clang/Sema/Lookup.h" #include "clang/Sema/Scope.h" diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 01811f6..c16f15a 100644 --- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -20,6 +20,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceManager.h" +#include "clang/Basic/TargetInfo.h" #include "clang/Lex/Lexer.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/OwningPtr.h" diff --git a/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp index e7e3162..4cb5953 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp @@ -11,6 +11,7 @@ #include "clang/StaticAnalyzer/Core/Checker.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "llvm/ADT/StringSwitch.h" using namespace clang; using namespace ento; diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index 0c2f266..f353c9a 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -18,6 +18,7 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" +#include "clang/AST/ExprCXX.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallString.h" using namespace clang; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index d5a5762..3444557 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "clang/AST/ExprCXX.h" #include "clang/StaticAnalyzer/Core/CheckerManager.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" -- 2.7.4