]> granicus.if.org Git - clang/commitdiff
Drop the ASTContext.h include from Stmt.h and fix up transitive users.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 4 Jul 2012 17:04:04 +0000 (17:04 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 4 Jul 2012 17:04:04 +0000 (17:04 +0000)
This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

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

27 files changed:
include/clang/AST/ASTVector.h
include/clang/AST/DeclCXX.h
include/clang/AST/DeclFriend.h
include/clang/AST/DeclTemplate.h
include/clang/AST/Expr.h
include/clang/AST/ExprCXX.h
include/clang/AST/RecordLayout.h
include/clang/AST/Stmt.h
include/clang/Frontend/ASTUnit.h
include/clang/Sema/DelayedDiagnostic.h
include/clang/Sema/Sema.h
include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
lib/ARCMigrate/TransformActions.cpp
lib/AST/Expr.cpp
lib/AST/LambdaMangleContext.cpp
lib/AST/StmtDumper.cpp
lib/AST/TypeLoc.cpp
lib/Analysis/CFG.cpp
lib/Analysis/PseudoConstantAnalysis.cpp
lib/CodeGen/CGDebugInfo.h
lib/Edit/RewriteObjCFoundationAPI.cpp
lib/Parse/ParseAST.cpp
lib/Sema/AttributeList.cpp
lib/Sema/SemaAccess.cpp
lib/Sema/SemaFixItUtils.cpp
lib/StaticAnalyzer/Core/BasicValueFactory.cpp

index 217dfade525f99fdadd703eb4895abb6a23807dd..4ff5ea37b8825d2034bf7d5df41ce5445139d0da 100644 (file)
@@ -374,7 +374,7 @@ void ASTVector<T>::grow(ASTContext &C, size_t MinSize) {
     NewCapacity = MinSize;
 
   // Allocate the memory from the ASTContext.
-  T *NewElts = new (C) T[NewCapacity];
+  T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
 
   // Copy the elements over.
   if (llvm::is_class<T>::value) {
@@ -387,7 +387,7 @@ void ASTVector<T>::grow(ASTContext &C, size_t MinSize) {
     memcpy(NewElts, Begin, CurSize * sizeof(T));
   }
 
-  C.Deallocate(Begin);
+  // ASTContext never frees any memory.
   Begin = NewElts;
   End = NewElts+CurSize;
   Capacity = Begin+NewCapacity;
index b7854feae1d5d8c5b57dd503624b2e68c8f41953..9130e28a47bcf98c2224bdd7f750203a36b3b799 100644 (file)
@@ -41,6 +41,7 @@ class CXXFinalOverriderMap;
 class CXXIndirectPrimaryBaseSet;
 class FriendDecl;
 class LambdaExpr;
+class UsingDecl;
 
 /// \brief Represents any kind of function declaration, whether it is a
 /// concrete function or a function template.
index ba1eb8d729f37ff571a58a8b6a57346f5862dc97..57a54e65076b2c9c4a3856834f6b0a02f530193f 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_AST_DECLFRIEND_H
 #define LLVM_CLANG_AST_DECLFRIEND_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "llvm/Support/Compiler.h"
 
index 7affc7e15f27152fa7ab618dbc9731782beb9cac..2727312d746144c7c83189dfb3179ec8ad19a5a9 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H
 #define LLVM_CLANG_AST_DECLTEMPLATE_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/Redeclarable.h"
 #include "clang/AST/TemplateBase.h"
index aedbefc5e1dbbe31e86b1837b9649657fd93d779..d9cf0ad162e9e184fee2a54d7abf80b4f778df7e 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_EXPR_H
 
 #include "clang/AST/APValue.h"
+#include "clang/AST/Decl.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/DeclAccessPair.h"
@@ -1163,16 +1164,8 @@ class IntegerLiteral : public Expr, public APIntStorage {
 public:
   // type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
   // or UnsignedLongLongTy
-  IntegerLiteral(ASTContext &C, const llvm::APInt &V,
-                 QualType type, SourceLocation l)
-    : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary, false, false,
-           false, false),
-      Loc(l) {
-    assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
-    assert(V.getBitWidth() == C.getIntWidth(type) &&
-           "Integer type is not the correct size for constant.");
-    setValue(C, V);
-  }
+  IntegerLiteral(ASTContext &C, const llvm::APInt &V, QualType type,
+                 SourceLocation l);
 
   /// \brief Returns a new integer literal with value 'V' and type 'type'.
   /// \param type - either IntTy, LongTy, LongLongTy, UnsignedIntTy,
@@ -1250,22 +1243,10 @@ class FloatingLiteral : public Expr, private APFloatStorage {
   SourceLocation Loc;
 
   FloatingLiteral(ASTContext &C, const llvm::APFloat &V, bool isexact,
-                  QualType Type, SourceLocation L)
-    : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary, false, false,
-           false, false), Loc(L) {
-    FloatingLiteralBits.IsIEEE =
-      &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
-    FloatingLiteralBits.IsExact = isexact;
-    setValue(C, V);
-  }
+                  QualType Type, SourceLocation L);
 
   /// \brief Construct an empty floating-point literal.
-  explicit FloatingLiteral(ASTContext &C, EmptyShell Empty)
-    : Expr(FloatingLiteralClass, Empty) {
-    FloatingLiteralBits.IsIEEE =
-      &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
-    FloatingLiteralBits.IsExact = false;
-  }
+  explicit FloatingLiteral(ASTContext &C, EmptyShell Empty);
 
 public:
   static FloatingLiteral *Create(ASTContext &C, const llvm::APFloat &V,
index d77722888edc61da5398286b3858d1bf75bcae15..5710cba6eaeeae9f7badafbe03c11b3e329a6e3a 100644 (file)
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_AST_EXPRCXX_H
 #define LLVM_CLANG_AST_EXPRCXX_H
 
+#include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/UnresolvedSet.h"
 #include "clang/AST/TemplateBase.h"
index 6f5c032a7803f9b60ce1c2b26c6432e90cdb7612..ba093636baa89f667517bc21aaa59011d6483ed3 100644 (file)
 #ifndef LLVM_CLANG_AST_LAYOUTINFO_H
 #define LLVM_CLANG_AST_LAYOUTINFO_H
 
-#include "llvm/Support/DataTypes.h"
-#include "llvm/ADT/DenseMap.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/DeclCXX.h"
+#include "llvm/ADT/DenseMap.h"
 
 namespace clang {
   class ASTContext;
index 3539c71634496aac1bd9dc102b887be681b2c01a..1662ba87b4c7b474c14a4e8b878200d85edb0820 100644 (file)
@@ -19,7 +19,6 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/StmtIterator.h"
 #include "clang/AST/DeclGroup.h"
-#include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Compiler.h"
@@ -37,9 +36,11 @@ namespace clang {
   class ParmVarDecl;
   class QualType;
   class IdentifierInfo;
+  class LabelDecl;
   class SourceManager;
   class StringLiteral;
   class SwitchStmt;
+  class VarDecl;
 
   //===--------------------------------------------------------------------===//
   // ExprIterator - Iterators for iterating over Stmt* arrays that contain
index cc503bc4eb3ba3755f592f186a434bc23933639b..afaf60e89a7908cd72d9d667765cdfd23fa7231c 100644 (file)
@@ -19,6 +19,7 @@
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/PreprocessingRecord.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/FileManager.h"
index 4f5bc20d4dd9d00ccce01bbabd61d852a9488425..c241266c9b8dab755a5c125c87445296606ca167 100644 (file)
@@ -40,17 +40,17 @@ public:
 
   bool isMemberAccess() const { return IsMember; }
 
-  AccessedEntity(ASTContext &Context,
+  AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator,
                  MemberNonce _,
                  CXXRecordDecl *NamingClass,
                  DeclAccessPair FoundDecl,
                  QualType BaseObjectType)
     : Access(FoundDecl.getAccess()), IsMember(true),
       Target(FoundDecl.getDecl()), NamingClass(NamingClass),
-      BaseObjectType(BaseObjectType), Diag(0, Context.getDiagAllocator()) {
+      BaseObjectType(BaseObjectType), Diag(0, Allocator) {
   }
 
-  AccessedEntity(ASTContext &Context,
+  AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator,
                  BaseNonce _,
                  CXXRecordDecl *BaseClass,
                  CXXRecordDecl *DerivedClass,
@@ -58,7 +58,7 @@ public:
     : Access(Access), IsMember(false),
       Target(BaseClass),
       NamingClass(DerivedClass),
-      Diag(0, Context.getDiagAllocator()) {
+      Diag(0, Allocator) {
   }
 
   bool isQuiet() const { return Diag.getDiagID() == 0; }
index d186c6f1dc0911f0abc05c892a247204488e9922..53798217829a4bb2dfcc53a3a83aad3bc03244a7 100644 (file)
@@ -28,6 +28,7 @@
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/LambdaMangleContext.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/NSAPI.h"
 #include "clang/Lex/ModuleLoader.h"
@@ -3302,7 +3303,7 @@ public:
   public:
     explicit ImplicitExceptionSpecification(Sema &Self)
       : Self(&Self), ComputedEST(EST_BasicNoexcept) {
-      if (!Self.Context.getLangOpts().CPlusPlus0x)
+      if (!Self.getLangOpts().CPlusPlus0x)
         ComputedEST = EST_DynamicNone;
     }
 
index e76c20e60ee13768e9e361cd48151db538787192..2e922c0cc3fe2fbff31232106aaaf3c6fb1fd0bc 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_GR_MEMREGION_H
 #define LLVM_CLANG_GR_MEMREGION_H
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/ExprObjC.h"
index c0fc380eec278fa5c1f3a32b3b2c6412cc9776e1..83c3a5634586b87bc22d75f3601bda6907789081 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_GR_SVALBUILDER
 #define LLVM_CLANG_GR_SVALBUILDER
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
index 0ecfeb54f85dd0c41a405191c0bc12f3305aa3ee..783db1c8f3aaad5867e8851272a0df04573c7f67 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Internals.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Basic/SourceManager.h"
index b68f864711316e002dc874d3a094645fc5efad17..f2f77367d8d9364862566b0f3af874b419aedf68 100644 (file)
@@ -555,6 +555,17 @@ void APNumericStorage::setIntValue(ASTContext &C, const llvm::APInt &Val) {
     VAL = 0;
 }
 
+IntegerLiteral::IntegerLiteral(ASTContext &C, const llvm::APInt &V,
+                               QualType type, SourceLocation l)
+  : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary, false, false,
+         false, false),
+    Loc(l) {
+  assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
+  assert(V.getBitWidth() == C.getIntWidth(type) &&
+         "Integer type is not the correct size for constant.");
+  setValue(C, V);
+}
+
 IntegerLiteral *
 IntegerLiteral::Create(ASTContext &C, const llvm::APInt &V,
                        QualType type, SourceLocation l) {
@@ -566,6 +577,23 @@ IntegerLiteral::Create(ASTContext &C, EmptyShell Empty) {
   return new (C) IntegerLiteral(Empty);
 }
 
+FloatingLiteral::FloatingLiteral(ASTContext &C, const llvm::APFloat &V,
+                                 bool isexact, QualType Type, SourceLocation L)
+  : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary, false, false,
+         false, false), Loc(L) {
+  FloatingLiteralBits.IsIEEE =
+    &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
+  FloatingLiteralBits.IsExact = isexact;
+  setValue(C, V);
+}
+
+FloatingLiteral::FloatingLiteral(ASTContext &C, EmptyShell Empty)
+  : Expr(FloatingLiteralClass, Empty) {
+  FloatingLiteralBits.IsIEEE =
+    &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
+  FloatingLiteralBits.IsExact = false;
+}
+
 FloatingLiteral *
 FloatingLiteral::Create(ASTContext &C, const llvm::APFloat &V,
                         bool isexact, QualType Type, SourceLocation L) {
index f5272a7fdbce2a2315a710598104f78c2a2b1fe4..6f4fe2d4b4eb806ac255602d11817932fe4b8d34 100644 (file)
@@ -11,7 +11,9 @@
 //  the Itanium C++ ABI mangling numbers for lambda expressions.
 //
 //===----------------------------------------------------------------------===//
+
 #include "clang/AST/LambdaMangleContext.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 
 using namespace clang;
index d5e12c873d0e13771052e850475128fca4d17693..962e35269c18ad72567a418a5dbc6e83abbd0e73 100644 (file)
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/StmtVisitor.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/PrettyPrinter.h"
index caa19b19df5400c1f19f470d7387989f7d9a08b3..c7bb7da4d17b20dafff1e391eb2808f0a9f7f360 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "llvm/Support/raw_ostream.h"
 #include "clang/AST/TypeLocVisitor.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "llvm/Support/ErrorHandling.h"
 using namespace clang;
index 9ac92dce372b33b8c47dda60e18af2365993d6a8..b69fbd6afb61b808d45887a273ba17371d8f01d4 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "llvm/Support/SaveAndRestore.h"
 #include "clang/Analysis/CFG.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/PrettyPrinter.h"
index c8b491a21682cc07ecaa0462dc007a7d25fe4a3e..5d659ce5851f137bfea2b03868e6f9078c3fc02b 100644 (file)
@@ -17,6 +17,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/Stmt.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include <deque>
 
 using namespace clang;
index 616b7038222c6607c72cd9f731a8d993a340c16d..44cc49ade123a95cac3db4ea2636ba0d33efad63 100644 (file)
@@ -30,6 +30,7 @@ namespace llvm {
 }
 
 namespace clang {
+  class CXXMethodDecl;
   class VarDecl;
   class ObjCInterfaceDecl;
   class ClassTemplateSpecializationDecl;
index 6ef2e642fb4502051a852a1c7782b6917e809ece..0e7b8779941cd831a504df2e541ba3f42fa21557 100644 (file)
@@ -14,6 +14,7 @@
 #include "clang/Edit/Rewriters.h"
 #include "clang/Edit/Commit.h"
 #include "clang/Lex/Lexer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/NSAPI.h"
index c50c1c980e5d962114688d0d1d4007eca3458acd..bd4f859521202232be557c720f390c95045b9a08 100644 (file)
@@ -18,6 +18,7 @@
 #include "clang/Sema/SemaConsumer.h"
 #include "clang/Sema/ExternalSemaSource.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/Stmt.h"
index 93f8c5d3595f333078583248e63b31c389d35cac..0f209fd7d6239b7c9d235ac9d881b36d289427a2 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Sema/AttributeList.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "llvm/ADT/StringSwitch.h"
index 7a7185f33d11962e12fd3d52e204e07c36682640..f71a38816f6ede3e84f2ceab623b15776bd0e685 100644 (file)
@@ -152,7 +152,8 @@ struct AccessTarget : public AccessedEntity {
                CXXRecordDecl *NamingClass,
                DeclAccessPair FoundDecl,
                QualType BaseObjectType)
-    : AccessedEntity(Context, Member, NamingClass, FoundDecl, BaseObjectType) {
+    : AccessedEntity(Context.getDiagAllocator(), Member, NamingClass,
+                     FoundDecl, BaseObjectType) {
     initialize();
   }
 
@@ -161,7 +162,8 @@ struct AccessTarget : public AccessedEntity {
                CXXRecordDecl *BaseClass,
                CXXRecordDecl *DerivedClass,
                AccessSpecifier Access)
-    : AccessedEntity(Context, Base, BaseClass, DerivedClass, Access) {
+    : AccessedEntity(Context.getDiagAllocator(), Base, BaseClass, DerivedClass,
+                     Access) {
     initialize();
   }
 
index fa99ef160a3bae7ea953080021729995d3f2082a..b61b9307dde9444fdce94b3958d5a3703e7a4c6f 100644 (file)
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/Lex/Preprocessor.h"
index fe96700772d6ab59180cbc73548c640552d1c4f2..20c73612c48195bd041744a00e6231b13171ca81 100644 (file)
@@ -13,6 +13,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "clang/AST/ASTContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"