]> granicus.if.org Git - clang/commitdiff
Use proper lexcial context for newly added ivars.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 17 Feb 2010 18:10:54 +0000 (18:10 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 17 Feb 2010 18:10:54 +0000 (18:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96484 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp
lib/Sema/SemaDeclObjC.cpp

index 46b62441d6e452b7d7158005f140a32864f776f5..26374af03a9e0f77f8f56da698bf390e94b965c8 100644 (file)
@@ -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.
 
index 465c4a9ee187ccd5d964133a58aa92d0b335656b..a7e0145a521495eaef681c63e4d4262ed348360c 100644 (file)
@@ -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;