diff options
Diffstat (limited to 'clang/Sema')
-rw-r--r-- | clang/Sema/Sema.cpp | 32 | ||||
-rw-r--r-- | clang/Sema/SemaDecl.cpp | 14 |
2 files changed, 25 insertions, 21 deletions
diff --git a/clang/Sema/Sema.cpp b/clang/Sema/Sema.cpp index 5b7a3094d12..d8549198beb 100644 --- a/clang/Sema/Sema.cpp +++ b/clang/Sema/Sema.cpp @@ -59,15 +59,16 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { TUScope->AddDecl(IDecl); // Synthesize "typedef struct objc_selector *SEL;" - RecordDecl *SelTag = new RecordDecl(Decl::Struct, SourceLocation(), - &Context.Idents.get("objc_selector"), 0); + RecordDecl *SelTag = RecordDecl::Create(Decl::Struct, SourceLocation(), + &Context.Idents.get("objc_selector"), + 0, Context); SelTag->getIdentifier()->setFETokenInfo(SelTag); TUScope->AddDecl(SelTag); QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag)); - TypedefDecl *SelTypedef = new TypedefDecl(SourceLocation(), - &Context.Idents.get("SEL"), - SelT, 0); + TypedefDecl *SelTypedef = TypedefDecl::Create(SourceLocation(), + &Context.Idents.get("SEL"), + SelT, 0, Context); SelTypedef->getIdentifier()->setFETokenInfo(SelTypedef); TUScope->AddDecl(SelTypedef); Context.setObjCSelType(SelTypedef); @@ -96,12 +97,12 @@ 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 = new RecordDecl(Decl::Struct, SourceLocation(), - &IT.get("objc_class"), 0); + RecordDecl *ClassTag = RecordDecl::Create(Decl::Struct, SourceLocation(), + &IT.get("objc_class"), 0,Context); QualType ClassT = Context.getPointerType(Context.getTagDeclType(ClassTag)); - TypedefDecl *ClassTypedef = new TypedefDecl(SourceLocation(), - &Context.Idents.get("Class"), - ClassT, 0); + TypedefDecl *ClassTypedef = + TypedefDecl::Create(SourceLocation(), &Context.Idents.get("Class"), + ClassT, 0, Context); Context.setObjCClassType(ClassTypedef); // Synthesize "@class Protocol; @@ -110,15 +111,16 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer) Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl)); // Synthesize "typedef struct objc_object { Class isa; } *id;" - RecordDecl *ObjectTag = new RecordDecl(Decl::Struct, SourceLocation(), - &IT.get("objc_object"), 0); + RecordDecl *ObjectTag = + RecordDecl::Create(Decl::Struct, SourceLocation(), &IT.get("objc_object"), + 0, Context); FieldDecl *IsaDecl = new FieldDecl(SourceLocation(), 0, Context.getObjCClassType()); ObjectTag->defineBody(&IsaDecl, 1); QualType ObjT = Context.getPointerType(Context.getTagDeclType(ObjectTag)); - TypedefDecl *IdTypedef = new TypedefDecl(SourceLocation(), - &Context.Idents.get("id"), - ObjT, 0); + TypedefDecl *IdTypedef = TypedefDecl::Create(SourceLocation(), + &Context.Idents.get("id"), + ObjT, 0, Context); Context.setObjCIdType(IdTypedef); } TUScope = 0; diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index 300a38259b6..90f9133d4b8 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/Sema/SemaDecl.cpp @@ -1175,8 +1175,9 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T, assert(!T.isNull() && "GetTypeForDeclarator() returned null type"); // Scope manipulation handled by caller. - TypedefDecl *NewTD = new TypedefDecl(D.getIdentifierLoc(), D.getIdentifier(), - T, LastDeclarator); + TypedefDecl *NewTD = TypedefDecl::Create(D.getIdentifierLoc(), + D.getIdentifier(), + T, LastDeclarator, Context); if (D.getInvalidType()) NewTD->setInvalidDecl(); return NewTD; @@ -1255,7 +1256,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 = new EnumDecl(Loc, Name, 0); + New = EnumDecl::Create(Loc, Name, 0, Context); // If this is an undefined enum, warn. if (TK != TK_Definition) Diag(Loc, diag::ext_forward_ref_enum); break; @@ -1264,7 +1265,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 = new RecordDecl(Kind, Loc, Name, 0); + New = RecordDecl::Create(Kind, Loc, Name, 0, Context); break; } @@ -1577,8 +1578,9 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl, } } - EnumConstantDecl *New = new EnumConstantDecl(IdLoc, Id, EltTy, Val, EnumVal, - LastEnumConst); + EnumConstantDecl *New = + EnumConstantDecl::Create(IdLoc, Id, EltTy, Val, EnumVal, LastEnumConst, + Context); // Register this decl in the current scope stack. New->setNext(Id->getFETokenInfo<ScopedDecl>()); |