[cfe-commits] r48398 - in /cfe/trunk: AST/ASTContext.cpp AST/Decl.cpp Driver/RewriteTest.cpp Sema/Sema.cpp Sema/SemaDecl.cpp Sema/SemaDeclObjC.cpp include/clang/AST/Decl.h

Chris Lattner sabre at nondot.org
Sat Mar 15 14:32:50 PDT 2008


Author: lattner
Date: Sat Mar 15 16:32:50 2008
New Revision: 48398

URL: http://llvm.org/viewvc/llvm-project?rev=48398&view=rev
Log:
move the ASTContext argument to be first in the argument list of 
all Create methods.

Modified:
    cfe/trunk/AST/ASTContext.cpp
    cfe/trunk/AST/Decl.cpp
    cfe/trunk/Driver/RewriteTest.cpp
    cfe/trunk/Sema/Sema.cpp
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/Sema/SemaDeclObjC.cpp
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Sat Mar 15 16:32:50 2008
@@ -1048,8 +1048,8 @@
 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;

Modified: cfe/trunk/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Decl.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/AST/Decl.cpp (original)
+++ cfe/trunk/AST/Decl.cpp Sat Mar 15 16:32:50 2008
@@ -205,24 +205,24 @@
 // 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 @@
 }
 
 
-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);
 }

Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Sat Mar 15 16:32:50 2008
@@ -796,7 +796,8 @@
         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::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 @@
   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 @@
   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 @@
 // 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::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;

Modified: cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/trunk/Sema/Sema.cpp Sat Mar 15 16:32:50 2008
@@ -59,16 +59,17 @@
   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 @@
   // 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 @@
     
     // 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;

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sat Mar 15 16:32:50 2008
@@ -794,11 +794,11 @@
              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 @@
   } 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 @@
   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 @@
   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 @@
   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 @@
   }
   
   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>());

Modified: cfe/trunk/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDeclObjC.cpp?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/Sema/SemaDeclObjC.cpp Sat Mar 15 16:32:50 2008
@@ -823,9 +823,9 @@
       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);

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=48398&r1=48397&r2=48398&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sat Mar 15 16:32:50 2008
@@ -354,9 +354,9 @@
                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 @@
               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 @@
     : 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 @@
   ~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 @@
   ~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 @@
     }
   ~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 @@
   ~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; }





More information about the cfe-commits mailing list