diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-23 21:11:20 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-02-23 21:11:20 +0000 |
commit | 2e85c5f297e6f141bf1dbe09d326457102daa288 (patch) | |
tree | d596e839d0dc9dc2e2605520d79b55d27154859f /clang/lib | |
parent | fdad25a40a2a87a7fc464ffa1fc9e37881cecbc5 (diff) | |
download | bcm5719-llvm-2e85c5f297e6f141bf1dbe09d326457102daa288.tar.gz bcm5719-llvm-2e85c5f297e6f141bf1dbe09d326457102daa288.zip |
[libclang] Make sure that all top-level decls in a @implementation are
marked as such.
Previously we missed tag declarations; fixes rdar://10902015
llvm-svn: 151283
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 416cb39a639..27bdd0beb1d 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -1532,9 +1532,7 @@ Parser::ParseObjCAtImplementationDeclaration(SourceLocation AtLoc) { } } - DeclsInGroup.push_back(ObjCImpDecl); - return Actions.BuildDeclaratorGroup( - DeclsInGroup.data(), DeclsInGroup.size(), false); + return Actions.ActOnFinishObjCImplementation(ObjCImpDecl, DeclsInGroup); } Parser::DeclGroupPtrTy diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index f3db4be1117..661c580cc97 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -988,6 +988,25 @@ Decl *Sema::ActOnStartClassImplementation( return ActOnObjCContainerStartDefinition(IMPDecl); } +Sema::DeclGroupPtrTy +Sema::ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef<Decl *> Decls) { + SmallVector<Decl *, 64> DeclsInGroup; + DeclsInGroup.reserve(Decls.size() + 1); + + for (unsigned i = 0, e = Decls.size(); i != e; ++i) { + Decl *Dcl = Decls[i]; + if (!Dcl) + continue; + if (Dcl->getDeclContext()->isFileContext()) + Dcl->setTopLevelDeclInObjCContainer(); + DeclsInGroup.push_back(Dcl); + } + + DeclsInGroup.push_back(ObjCImpDecl); + + return BuildDeclaratorGroup(DeclsInGroup.data(), DeclsInGroup.size(), false); +} + void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **ivars, unsigned numIvars, SourceLocation RBrace) { |