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 | 644af7b50bd0541468b45c197f5b637e934d48a0 (patch) | |
tree | 4ab0851ffd2b1226554263a61d4f45b7a4c52e6d /lib | |
parent | cd42724e013dc1f55c10bd3ecf8aa0aa04eef300 (diff) |
[libclang] Make sure that all top-level decls in a @implementation are
marked as such.
Previously we missed tag declarations; fixes rdar://10902015
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 19 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 416cb39a63..27bdd0beb1 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/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/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index f3db4be111..661c580cc9 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/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) { |