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
}
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.
--- /dev/null
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
+// rdar://12581683
+
+extern "C" {
+@interface RetainBucket
++ (id) sharedRetainBucket;
+@end
+
+@implementation RetainBucket
++ (id) sharedRetainBucket
+{
+ static id sharedBucket = (id)0;
+ return sharedBucket;
+}
+@end
+}
+