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/Sema/SemaDeclObjC.cpp | |
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/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 991948f18c..2ee5a7d83a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -695,7 +695,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, // the enclosing method declarations. We mark the decl invalid // to make it clear that this isn't a valid AST. CDecl = ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, - ClassLoc, CategoryLoc, CategoryName); + ClassLoc, CategoryLoc, CategoryName,IDecl); CDecl->setInvalidDecl(); Diag(ClassLoc, diag::err_undef_interface) << ClassName; return CDecl; @@ -707,19 +707,6 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, diag::note_implementation_declared); } - CDecl = ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, - ClassLoc, CategoryLoc, CategoryName); - // FIXME: PushOnScopeChains? - CurContext->addDecl(CDecl); - - CDecl->setClassInterface(IDecl); - // Insert class extension to the list of class's categories. - if (!CategoryName) - CDecl->insertNextClassCategory(); - - // If the interface is deprecated, warn about it. - (void)DiagnoseUseOfDecl(IDecl, ClassLoc); - if (CategoryName) { /// Check for duplicate interface declaration for this category ObjCCategoryDecl *CDeclChain; @@ -733,10 +720,16 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, break; } } - if (!CDeclChain) - CDecl->insertNextClassCategory(); } + CDecl = ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, + ClassLoc, CategoryLoc, CategoryName, IDecl); + // FIXME: PushOnScopeChains? + CurContext->addDecl(CDecl); + + // If the interface is deprecated, warn about it. + (void)DiagnoseUseOfDecl(IDecl, ClassLoc); + if (NumProtoRefs) { CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs, ProtoLocs, Context); @@ -766,9 +759,7 @@ Decl *Sema::ActOnStartCategoryImplementation( // Create and install one. CatIDecl = ObjCCategoryDecl::Create(Context, CurContext, SourceLocation(), SourceLocation(), SourceLocation(), - CatName); - CatIDecl->setClassInterface(IDecl); - CatIDecl->insertNextClassCategory(); + CatName, IDecl); } } |