diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-30 19:43:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-30 19:43:26 +0000 |
commit | 955fadbdfecfa24a590febe66a86519096787f2d (patch) | |
tree | 60bc67856c209a70ab692b7668a1636a816d4629 /lib/AST | |
parent | 45118d8f2b50a37472dd03cd1d5b4abd7ae9f25b (diff) |
Remove a few mutating ObjCCategoryDecl methods.
Remove
-setClassInterface
-setNextClassCategory
-insertNextClassCategory
and combine them in the Create function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/ASTImporter.cpp | 7 | ||||
-rw-r--r-- | lib/AST/DeclObjC.cpp | 20 |
2 files changed, 20 insertions, 7 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index b6e3e621d5..7174dbe867 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -2986,15 +2986,12 @@ Decl *ASTNodeImporter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) { Importer.Import(D->getAtLoc()), Loc, Importer.Import(D->getCategoryNameLoc()), - Name.getAsIdentifierInfo()); + Name.getAsIdentifierInfo(), + ToInterface); ToCategory->setLexicalDeclContext(LexicalDC); LexicalDC->addDecl(ToCategory); Importer.Imported(D, ToCategory); - // Link this category into its class's category list. - ToCategory->setClassInterface(ToInterface); - ToCategory->insertNextClassCategory(); - // Import protocols SmallVector<ObjCProtocolDecl *, 4> Protocols; SmallVector<SourceLocation, 4> ProtocolLocs; diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 09638fefbd..ad2fd289a7 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -909,8 +909,24 @@ ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, - IdentifierInfo *Id) { - return new (C) ObjCCategoryDecl(DC, AtLoc, ClassNameLoc, CategoryNameLoc, Id); + IdentifierInfo *Id, + ObjCInterfaceDecl *IDecl) { + ObjCCategoryDecl *CatDecl = new (C) ObjCCategoryDecl(DC, AtLoc, ClassNameLoc, + CategoryNameLoc, Id, + IDecl); + if (IDecl) { + // Link this category into its class's category list. + CatDecl->NextClassCategory = IDecl->getCategoryList(); + IDecl->setCategoryList(CatDecl); + IDecl->setChangedSinceDeserialization(true); + } + + return CatDecl; +} + +ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, EmptyShell Empty) { + return new (C) ObjCCategoryDecl(0, SourceLocation(), SourceLocation(), + SourceLocation(), 0, 0); } ObjCCategoryImplDecl *ObjCCategoryDecl::getImplementation() const { |