]> granicus.if.org Git - clang/commitdiff
move the ASTContext argument to be first in the argument list of
authorChris Lattner <sabre@nondot.org>
Sat, 15 Mar 2008 21:32:50 +0000 (21:32 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 15 Mar 2008 21:32:50 +0000 (21:32 +0000)
all Create methods.

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

AST/ASTContext.cpp
AST/Decl.cpp
Driver/RewriteTest.cpp
Sema/Sema.cpp
Sema/SemaDecl.cpp
Sema/SemaDeclObjC.cpp
include/clang/AST/Decl.h

index ad54010c50005693e4ccfdd830b65facee3cf54a..db4d53aa481ec6783fe6865eb169c5fa628c5dbd 100644 (file)
@@ -1048,8 +1048,8 @@ QualType ASTContext::maxIntegerType(QualType lhs, QualType rhs) {
 QualType ASTContext::getCFConstantStringType() {
   if (!CFConstantStringTypeDecl) {
     CFConstantStringTypeDecl = 
-      RecordDecl::Create(Decl::Struct, SourceLocation(), 
-                         &Idents.get("NSConstantString"), 0, *this);
+      RecordDecl::Create(*this, Decl::Struct, SourceLocation(), 
+                         &Idents.get("NSConstantString"), 0);
     QualType FieldTypes[4];
   
     // const int *isa;
index 8487efb8449b406cf43872100e723f120bf76d55..7fa679cbc08302a8450a7f88a45649e9ccfdb25a 100644 (file)
@@ -205,24 +205,24 @@ void Decl::addDeclKind(Kind k) {
 // Decl Allocation/Deallocation Method Implementations
 //===----------------------------------------------------------------------===//
 
-BlockVarDecl *BlockVarDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                                   QualType T, StorageClass S,
-                                   ScopedDecl *PrevDecl, ASTContext &C) {
+BlockVarDecl *BlockVarDecl::Create(ASTContext &C, SourceLocation L,
+                                   IdentifierInfo *Id, QualType T,
+                                   StorageClass S, ScopedDecl *PrevDecl) {
   void *Mem = C.getAllocator().Allocate<BlockVarDecl>();
   return new (Mem) BlockVarDecl(L, Id, T, S, PrevDecl);
 }
 
 
-FileVarDecl *FileVarDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                                 QualType T, StorageClass S, 
-                                 ScopedDecl *PrevDecl, ASTContext &C) {
+FileVarDecl *FileVarDecl::Create(ASTContext &C, SourceLocation L,
+                                 IdentifierInfo *Id, QualType T, StorageClass S,
+                                 ScopedDecl *PrevDecl) {
   void *Mem = C.getAllocator().Allocate<FileVarDecl>();
   return new (Mem) FileVarDecl(L, Id, T, S, PrevDecl);
 }
 
-ParmVarDecl *ParmVarDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                                 QualType T, StorageClass S, 
-                                 ScopedDecl *PrevDecl, ASTContext &C) {
+ParmVarDecl *ParmVarDecl::Create(ASTContext &C, SourceLocation L,
+                                 IdentifierInfo *Id, QualType T, StorageClass S,
+                                 ScopedDecl *PrevDecl) {
   void *Mem = C.getAllocator().Allocate<ParmVarDecl>();
   return new (Mem) ParmVarDecl(L, Id, T, S, PrevDecl);
 }
@@ -236,28 +236,29 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, SourceLocation L,
 }
 
 
-EnumConstantDecl *EnumConstantDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                                           QualType T, Expr *E, 
-                                           const llvm::APSInt &V, 
-                                           ScopedDecl *PrevDecl, ASTContext &C){
+EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, SourceLocation L,
+                                           IdentifierInfo *Id, QualType T,
+                                           Expr *E, const llvm::APSInt &V, 
+                                           ScopedDecl *PrevDecl){
   void *Mem = C.getAllocator().Allocate<EnumConstantDecl>();
   return new (Mem) EnumConstantDecl(L, Id, T, E, V, PrevDecl);
 }
 
-TypedefDecl *TypedefDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                                 QualType T, ScopedDecl *PD, ASTContext &C) {
+TypedefDecl *TypedefDecl::Create(ASTContext &C, SourceLocation L,
+                                 IdentifierInfo *Id, QualType T,
+                                 ScopedDecl *PD) {
   void *Mem = C.getAllocator().Allocate<TypedefDecl>();
   return new (Mem) TypedefDecl(L, Id, T, PD);
 }
 
-EnumDecl *EnumDecl::Create(SourceLocation L, IdentifierInfo *Id,
-                           ScopedDecl *PrevDecl, ASTContext &C) {
+EnumDecl *EnumDecl::Create(ASTContext &C, SourceLocation L, IdentifierInfo *Id,
+                           ScopedDecl *PrevDecl) {
   void *Mem = C.getAllocator().Allocate<EnumDecl>();
   return new (Mem) EnumDecl(L, Id, PrevDecl);
 }
 
-RecordDecl *RecordDecl::Create(Kind DK, SourceLocation L, IdentifierInfo *Id, 
-                               ScopedDecl *PrevDecl, ASTContext &C) {
+RecordDecl *RecordDecl::Create(ASTContext &C, Kind DK, SourceLocation L,
+                               IdentifierInfo *Id, ScopedDecl *PrevDecl) {
   void *Mem = C.getAllocator().Allocate<RecordDecl>();
   return new (Mem) RecordDecl(DK, L, Id, PrevDecl);
 }
index d2af2bd2e01a5470c40de745626d5b25e5989b67..b4de21c707c80ec6e0535f820fd592909943bf96 100644 (file)
@@ -796,7 +796,8 @@ Stmt *RewriteTest::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
         std::string RecName = clsDeclared->getIdentifier()->getName();
         RecName += "_IMPL";
         IdentifierInfo *II = &Context->Idents.get(RecName.c_str());
-        RecordDecl *RD = RecordDecl::Create(Decl::Struct, SourceLocation(), II, 0, *Context);
+        RecordDecl *RD = RecordDecl::Create(*Context, Decl::Struct, 
+                                            SourceLocation(), II, 0);
         assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
         QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
         CastExpr *castExpr = new CastExpr(castT, IV->getBase(), SourceLocation());
@@ -1622,9 +1623,8 @@ void RewriteTest::SynthMsgSendFunctionDecl() {
 void RewriteTest::SynthMsgSendSuperFunctionDecl() {
   IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper");
   llvm::SmallVector<QualType, 16> ArgTys;
-  RecordDecl *RD = RecordDecl::Create(Decl::Struct, SourceLocation(),
-                                      &Context->Idents.get("objc_super"), 0,
-                                      *Context);
+  RecordDecl *RD = RecordDecl::Create(*Context, Decl::Struct, SourceLocation(),
+                                      &Context->Idents.get("objc_super"), 0);
   QualType argT = Context->getPointerType(Context->getTagDeclType(RD));
   assert(!argT.isNull() && "Can't build 'struct objc_super *' type");
   ArgTys.push_back(argT);
@@ -1663,9 +1663,8 @@ void RewriteTest::SynthMsgSendSuperStretFunctionDecl() {
   IdentifierInfo *msgSendIdent = 
     &Context->Idents.get("objc_msgSendSuper_stret");
   llvm::SmallVector<QualType, 16> ArgTys;
-  RecordDecl *RD = RecordDecl::Create(Decl::Struct, SourceLocation(),
-                                      &Context->Idents.get("objc_super"), 0,
-                                      *Context);
+  RecordDecl *RD = RecordDecl::Create(*Context, Decl::Struct, SourceLocation(),
+                                      &Context->Idents.get("objc_super"), 0);
   QualType argT = Context->getPointerType(Context->getTagDeclType(RD));
   assert(!argT.isNull() && "Can't build 'struct objc_super *' type");
   ArgTys.push_back(argT);
@@ -1745,9 +1744,9 @@ Stmt *RewriteTest::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
   InsertText(SourceLocation::getFileLoc(MainFileID, 0), 
              StrObjDecl.c_str(), StrObjDecl.size());
   
-  FileVarDecl *NewVD = FileVarDecl::Create(SourceLocation(), 
+  FileVarDecl *NewVD = FileVarDecl::Create(*Context, SourceLocation(), 
                                        &Context->Idents.get(S.c_str()), strType, 
-                                       VarDecl::Static, NULL, *Context);
+                                       VarDecl::Static, NULL);
   DeclRefExpr *DRE = new DeclRefExpr(NewVD, strType, SourceLocation());
   Expr *Unop = new UnaryOperator(DRE, UnaryOperator::AddrOf,
                                  Context->getPointerType(DRE->getType()), 
@@ -1793,9 +1792,9 @@ ObjCInterfaceDecl *RewriteTest::isSuperReceiver(Expr *recExpr) {
 // struct objc_super { struct objc_object *receiver; struct objc_class *super; };
 QualType RewriteTest::getSuperStructType() {
   if (!SuperStructDecl) {
-    SuperStructDecl = RecordDecl::Create(Decl::Struct, SourceLocation(), 
-                                         &Context->Idents.get("objc_super"), 0,
-                                         *Context);
+    SuperStructDecl = RecordDecl::Create(*Context, Decl::Struct,
+                                         SourceLocation(), 
+                                         &Context->Idents.get("objc_super"), 0);
     QualType FieldTypes[2];
   
     // struct objc_object *receiver;
@@ -1815,9 +1814,9 @@ QualType RewriteTest::getSuperStructType() {
 
 QualType RewriteTest::getConstantStringStructType() {
   if (!ConstantStringDecl) {
-    ConstantStringDecl = RecordDecl::Create(Decl::Struct, SourceLocation(), 
-                         &Context->Idents.get("__NSConstantStringImpl"), 0,
-                                            *Context);
+    ConstantStringDecl = RecordDecl::Create(*Context, Decl::Struct,
+                                            SourceLocation(), 
+                         &Context->Idents.get("__NSConstantStringImpl"), 0);
     QualType FieldTypes[4];
   
     // struct objc_object *receiver;
index d8549198beb53d764addc13be962cf255c9b1732..4bd04e3a1a535723abbaee7e30f40f3b5722e8d7 100644 (file)
@@ -59,16 +59,17 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
   TUScope->AddDecl(IDecl);
   
   // Synthesize "typedef struct objc_selector *SEL;"
-  RecordDecl *SelTag = RecordDecl::Create(Decl::Struct, SourceLocation(), 
+  RecordDecl *SelTag = RecordDecl::Create(Context, Decl::Struct,
+                                          SourceLocation(), 
                                           &Context.Idents.get("objc_selector"),
-                                          0, Context);
+                                          0);
   SelTag->getIdentifier()->setFETokenInfo(SelTag);
   TUScope->AddDecl(SelTag);
   
   QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag));
-  TypedefDecl *SelTypedef = TypedefDecl::Create(SourceLocation(),
+  TypedefDecl *SelTypedef = TypedefDecl::Create(Context, SourceLocation(),
                                                 &Context.Idents.get("SEL"),
-                                                SelT, 0, Context);
+                                                SelT, 0);
   SelTypedef->getIdentifier()->setFETokenInfo(SelTypedef);
   TUScope->AddDecl(SelTypedef);
   Context.setObjCSelType(SelTypedef);
@@ -97,12 +98,13 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
   // and make sure the decls get inserted into TUScope!
   if (PP.getLangOptions().ObjC1) {
     // Synthesize "typedef struct objc_class *Class;"
-    RecordDecl *ClassTag = RecordDecl::Create(Decl::Struct, SourceLocation(), 
-                                              &IT.get("objc_class"), 0,Context);
+    RecordDecl *ClassTag = RecordDecl::Create(Context, Decl::Struct,
+                                              SourceLocation(), 
+                                              &IT.get("objc_class"), 0);
     QualType ClassT = Context.getPointerType(Context.getTagDeclType(ClassTag));
     TypedefDecl *ClassTypedef = 
-      TypedefDecl::Create(SourceLocation(), &Context.Idents.get("Class"),
-                          ClassT, 0, Context);
+      TypedefDecl::Create(Context, SourceLocation(),
+                          &Context.Idents.get("Class"), ClassT, 0);
     Context.setObjCClassType(ClassTypedef);
     
     // Synthesize "@class Protocol;
@@ -112,15 +114,15 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
     
     // Synthesize "typedef struct objc_object { Class isa; } *id;"
     RecordDecl *ObjectTag = 
-      RecordDecl::Create(Decl::Struct, SourceLocation(), &IT.get("objc_object"),
-                         0, Context);
+      RecordDecl::Create(Context, Decl::Struct, SourceLocation(),
+                         &IT.get("objc_object"), 0);
     FieldDecl *IsaDecl = new FieldDecl(SourceLocation(), 0, 
                                        Context.getObjCClassType());
     ObjectTag->defineBody(&IsaDecl, 1);
     QualType ObjT = Context.getPointerType(Context.getTagDeclType(ObjectTag));
-    TypedefDecl *IdTypedef = TypedefDecl::Create(SourceLocation(),
+    TypedefDecl *IdTypedef = TypedefDecl::Create(Context, SourceLocation(),
                                                  &Context.Idents.get("id"),
-                                                 ObjT, 0, Context);
+                                                 ObjT, 0);
     Context.setObjCIdType(IdTypedef);
   }
   TUScope = 0;
index a4c1a781ef67d4cc453421f9f65765385a36147d..7914e865741b4cd920024745517d83bd948c53cb 100644 (file)
@@ -794,11 +794,11 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
              R.getAsString());
         InvalidDecl = true;
       }
-      NewVD = FileVarDecl::Create(D.getIdentifierLoc(), II, R, SC,
-                                  LastDeclarator, Context);
+      NewVD = FileVarDecl::Create(Context, D.getIdentifierLoc(), II, R, SC,
+                                  LastDeclarator);
     } else {
-      NewVD = BlockVarDecl::Create(D.getIdentifierLoc(), II, R, SC,
-                                   LastDeclarator, Context);
+      NewVD = BlockVarDecl::Create(Context, D.getIdentifierLoc(), II, R, SC,
+                                   LastDeclarator);
     }
     // Handle attributes prior to checking for duplicates in MergeVarDecl
     HandleDeclAttributes(NewVD, D.getDeclSpec().getAttributes(),
@@ -1017,8 +1017,8 @@ Sema::ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,
   } else if (parmDeclType->isFunctionType())
     parmDeclType = Context.getPointerType(parmDeclType);
   
-  ParmVarDecl *New = ParmVarDecl::Create(PI.IdentLoc, II, parmDeclType, 
-                                         VarDecl::None, 0, Context);
+  ParmVarDecl *New = ParmVarDecl::Create(Context, PI.IdentLoc, II, parmDeclType, 
+                                         VarDecl::None, 0);
   
   if (PI.InvalidType)
     New->setInvalidDecl();
@@ -1178,9 +1178,9 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
   assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
   
   // Scope manipulation handled by caller.
-  TypedefDecl *NewTD = TypedefDecl::Create(D.getIdentifierLoc(), 
+  TypedefDecl *NewTD = TypedefDecl::Create(Context, D.getIdentifierLoc(), 
                                            D.getIdentifier(), 
-                                           T, LastDeclarator, Context);
+                                           T, LastDeclarator);
   if (D.getInvalidType())
     NewTD->setInvalidDecl();
   return NewTD;
@@ -1259,7 +1259,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
   case Decl::Enum:
     // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
     // enum X { A, B, C } D;    D should chain to X.
-    New = EnumDecl::Create(Loc, Name, 0, Context);
+    New = EnumDecl::Create(Context, Loc, Name, 0);
     // If this is an undefined enum, warn.
     if (TK != TK_Definition) Diag(Loc, diag::ext_forward_ref_enum);
     break;
@@ -1268,7 +1268,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
   case Decl::Class:
     // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
     // struct X { int A; } D;    D should chain to X.
-    New = RecordDecl::Create(Kind, Loc, Name, 0, Context);
+    New = RecordDecl::Create(Context, Kind, Loc, Name, 0);
     break;
   }    
   
@@ -1582,8 +1582,8 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
   }
   
   EnumConstantDecl *New = 
-    EnumConstantDecl::Create(IdLoc, Id, EltTy, Val, EnumVal, LastEnumConst,
-                             Context);
+    EnumConstantDecl::Create(Context, IdLoc, Id, EltTy, Val, EnumVal,
+                             LastEnumConst);
   
   // Register this decl in the current scope stack.
   New->setNext(Id->getFETokenInfo<ScopedDecl>());
index 1e60a3964787d8e5c2c1127925cbd536ca57676d..20d127b31ebc70ba8d7fd65f54e0fe8ac82aca8b 100644 (file)
@@ -823,9 +823,9 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
       argType = QualType::getFromOpaquePtr(ArgTypes[i]);
     else
       argType = Context.getObjCIdType();
-    ParmVarDecl* Param = ParmVarDecl::Create(SourceLocation(/*FIXME*/),
+    ParmVarDecl* Param = ParmVarDecl::Create(Context, SourceLocation(/*FIXME*/),
                                              ArgNames[i], argType,
-                                             VarDecl::None, 0, Context);
+                                             VarDecl::None, 0);
     Param->setObjCDeclQualifier(
       CvtQTToAstBitMask(ArgQT[i].getObjCDeclQualifier()));
     Params.push_back(Param);
index cf9290cfbde9868d0308ac16c1d89a9f0223a623..b53d5d3bcb01cc87816d1827bdcddc42c335dbdf 100644 (file)
@@ -354,9 +354,9 @@ class BlockVarDecl : public VarDecl {
                ScopedDecl *PrevDecl)
     : VarDecl(BlockVar, L, Id, T, S, PrevDecl) {}
 public:
-  static BlockVarDecl *Create(SourceLocation L, IdentifierInfo *Id, QualType T,
-                              StorageClass S, ScopedDecl *PrevDecl,
-                              ASTContext &C);
+  static BlockVarDecl *Create(ASTContext &C, SourceLocation L,
+                              IdentifierInfo *Id, QualType T, StorageClass S,
+                              ScopedDecl *PrevDecl);
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == BlockVar; }
   static bool classof(const BlockVarDecl *D) { return true; }  
@@ -377,9 +377,8 @@ class FileVarDecl : public VarDecl {
               ScopedDecl *PrevDecl)
     : VarDecl(FileVar, L, Id, T, S, PrevDecl) {}
 public:
-  static FileVarDecl *Create(SourceLocation L, IdentifierInfo *Id, QualType T,
-                             StorageClass S, ScopedDecl *PrevDecl,
-                             ASTContext &C);
+  static FileVarDecl *Create(ASTContext &C, SourceLocation L,IdentifierInfo *Id,
+                             QualType T, StorageClass S, ScopedDecl *PrevDecl);
   
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == FileVar; }
@@ -404,9 +403,8 @@ class ParmVarDecl : public VarDecl {
     : VarDecl(ParmVar, L, Id, T, S, PrevDecl), 
     objcDeclQualifier(OBJC_TQ_None) {}
 public:
-  static ParmVarDecl *Create(SourceLocation L, IdentifierInfo *Id, QualType T,
-                             StorageClass S, ScopedDecl *PrevDecl,
-                             ASTContext &C);
+  static ParmVarDecl *Create(ASTContext &C, SourceLocation L,IdentifierInfo *Id,
+                             QualType T, StorageClass S, ScopedDecl *PrevDecl);
   
   ObjCDeclQualifier getObjCDeclQualifier() const {
     return ObjCDeclQualifier(objcDeclQualifier);
@@ -559,9 +557,9 @@ protected:
   ~EnumConstantDecl() {}
 public:
 
-  static EnumConstantDecl *Create(SourceLocation L, IdentifierInfo *Id,
-                                  QualType T, Expr *E, const llvm::APSInt &V, 
-                                  ScopedDecl *PrevDecl, ASTContext &C);
+  static EnumConstantDecl *Create(ASTContext &C, SourceLocation L,
+                                  IdentifierInfo *Id, QualType T, Expr *E,
+                                  const llvm::APSInt &V, ScopedDecl *PrevDecl);
   
   const Expr *getInitExpr() const { return Init; }
   Expr *getInitExpr() { return Init; }
@@ -615,8 +613,8 @@ class TypedefDecl : public TypeDecl {
   ~TypedefDecl() {}
 public:
   
-  static TypedefDecl *Create(SourceLocation L, IdentifierInfo *Id, QualType T,
-                             ScopedDecl *PD, ASTContext &C);
+  static TypedefDecl *Create(ASTContext &C, SourceLocation L,IdentifierInfo *Id,
+                             QualType T, ScopedDecl *PD);
   
   QualType getUnderlyingType() const { return UnderlyingType; }
   void setUnderlyingType(QualType newType) { UnderlyingType = newType; }
@@ -691,8 +689,8 @@ class EnumDecl : public TagDecl {
     }
   ~EnumDecl() {}
 public:
-  static EnumDecl *Create(SourceLocation L, IdentifierInfo *Id,
-                          ScopedDecl *PrevDecl, ASTContext &C);
+  static EnumDecl *Create(ASTContext &C, SourceLocation L, IdentifierInfo *Id,
+                          ScopedDecl *PrevDecl);
   
   /// defineElements - When created, EnumDecl correspond to a forward declared
   /// enum.  This method is used to mark the decl as being defined, with the
@@ -754,8 +752,8 @@ class RecordDecl : public TagDecl {
   ~RecordDecl() {}
 public:
   
-  static RecordDecl *Create(Kind DK, SourceLocation L, IdentifierInfo *Id, 
-                            ScopedDecl *PrevDecl, ASTContext &C);
+  static RecordDecl *Create(ASTContext &C, Kind DK, SourceLocation L,
+                            IdentifierInfo *Id, ScopedDecl *PrevDecl);
   
   bool hasFlexibleArrayMember() const { return HasFlexibleArrayMember; }
   void setHasFlexibleArrayMember(bool V) { HasFlexibleArrayMember = V; }