From: Fariborz Jahanian Date: Wed, 17 Feb 2010 18:10:54 +0000 (+0000) Subject: Use proper lexcial context for newly added ivars. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f14c4d18fcba4b4577dbe43016d6d42ef9973cf;p=clang Use proper lexcial context for newly added ivars. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96484 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 46b62441d6..26374af03a 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -110,6 +110,7 @@ static bool CanBlockBeGlobal(const CodeGenFunction::BlockInfo &Info) { /// invoke function. static void AllocateAllBlockDeclRefs(const CodeGenFunction::BlockInfo &Info, CodeGenFunction *CGF) { +#if 0 // Always allocate self, as it is often handy in the debugger, even if there // is no codegen in the block that uses it. This is also useful to always do // this as if we didn't, we'd have to figure out all code that uses a self @@ -122,6 +123,7 @@ static void AllocateAllBlockDeclRefs(const CodeGenFunction::BlockInfo &Info, SelfDecl->getType(), SourceLocation(), false); CGF->AllocateBlockDecl(BDRE); } +#endif // FIXME: Also always forward the this pointer in C++ as well. diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 465c4a9ee1..a7e0145a52 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -825,8 +825,8 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, 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]); + ivars[i]->setLexicalDeclContext(ImpDecl); + IDecl->makeDeclVisibleInContext(ivars[i], false); } return;