objective-C IRGen: for @implementation nested in

extern "C", its method definitions must be IRGen'ed
before meta-data for class is generated. Otherwise,
IRGen crashes (to say the least).
// rdar://12581683 

llvm-svn: 166809
This commit is contained in:
Fariborz Jahanian
2012-10-26 20:22:11 +00:00
parent c2c77c42ef
commit 2d26c29e0c
2 changed files with 25 additions and 1 deletions

View File

@@ -2582,8 +2582,15 @@ void CodeGenModule::EmitLinkageSpec(const LinkageSpecDecl *LSD) {
}
for (RecordDecl::decl_iterator I = LSD->decls_begin(), E = LSD->decls_end();
I != E; ++I)
I != E; ++I) {
if (ObjCImplDecl *OID = dyn_cast<ObjCImplDecl>(*I)) {
for (ObjCContainerDecl::method_iterator M = OID->meth_begin(),
MEnd = OID->meth_end();
M != MEnd; ++M)
EmitTopLevelDecl(*M);
}
EmitTopLevelDecl(*I);
}
}
/// EmitTopLevelDecl - Emit code for a single top level declaration.