Allow for declaration and use of ivars in a stand-alone

implementation (toward radar 7547942).

llvm-svn: 96479
This commit is contained in:
Fariborz Jahanian 2010-02-17 17:00:07 +00:00
parent 98d156a87e
commit 20912d644a
2 changed files with 18 additions and 0 deletions

View File

@ -823,6 +823,12 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
if (IDecl->isImplicitInterfaceDecl()) {
IDecl->setIVarList(ivars, numIvars, Context);
IDecl->setLocEnd(RBrace);
// Add ivar's to class's DeclContext.
for (unsigned i = 0, e = numIvars; i != e; ++i) {
ivars[i]->setLexicalDeclContext(IDecl);
IDecl->addDecl(ivars[i]);
}
return;
}
// If implementation has empty ivar list, just return.

View File

@ -0,0 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// radar 7547942
// Allow injection of ivars into implementation's implicit class.
@implementation INTFSTANDALONE // expected-warning {{cannot find interface declaration for 'INTFSTANDALONE'}}
{
id IVAR1;
id IVAR2;
}
- (id) Meth { return IVAR1; }
@end