diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-31 18:48:14 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-31 18:48:14 +0000 |
commit | 3a3ca1b35a7121aea0bf465a192dce748465e10f (patch) | |
tree | 412075ffef4feb9054827a049df26c445b0a2f05 /Sema/SemaDecl.cpp | |
parent | 8ee529b5671295ea38c249df8b9d3766c905cfa7 (diff) |
Fixed problem with rewriting stand-alone @implementation (with no matching @interface).
A new test case added.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaDecl.cpp')
-rw-r--r-- | Sema/SemaDecl.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index ea73db5088..66ece4149a 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1253,10 +1253,12 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( if (!IDecl) { // Legacy case of @implementation with no corresponding @interface. // Build, chain & install the interface decl into the identifier. - IDecl = new ObjcInterfaceDecl(SourceLocation(), 0, ClassName); + IDecl = new ObjcInterfaceDecl(AtClassImplLoc, 0, ClassName, + false, true); IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>()); ClassName->setFETokenInfo(IDecl); IDecl->setSuperClass(SDecl); + IDecl->setLocEnd(ClassLoc); // Remember that this needs to be removed when the scope is popped. TUScope->AddDecl(IDecl); @@ -1273,7 +1275,8 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( } void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, - ObjcIvarDecl **ivars, unsigned numIvars) { + ObjcIvarDecl **ivars, unsigned numIvars, + SourceLocation RBrace) { assert(ImpDecl && "missing implementation decl"); ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier()); if (!IDecl) @@ -1282,7 +1285,7 @@ void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl, /// (legacy objective-c @implementation decl without an @interface decl). /// Add implementations's ivar to the synthesize class's ivar list. if (IDecl->ImplicitInterfaceDecl()) { - IDecl->addInstanceVariablesToClass(ivars, numIvars, SourceLocation()); + IDecl->addInstanceVariablesToClass(ivars, numIvars, RBrace); return; } @@ -1795,7 +1798,7 @@ void Sema::ActOnFields(Scope* S, cast<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl)); assert(IMPDecl && "ActOnFields - missing ObjcImplementationDecl"); IMPDecl->ObjcAddInstanceVariablesToClassImpl(ClsFields, RecFields.size()); - CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size()); + CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac); } } } |