[cfe-commits] r166809 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenObjCXX/implementation-in-extern-c.mm

Eli Friedman eli.friedman at gmail.com
Fri Oct 26 15:04:48 PDT 2012


On Fri, Oct 26, 2012 at 1:22 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Fri Oct 26 15:22:11 2012
> New Revision: 166809
>
> URL: http://llvm.org/viewvc/llvm-project?rev=166809&view=rev
> Log:
> 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
>
> Added:
>     cfe/trunk/test/CodeGenObjCXX/implementation-in-extern-c.mm
> Modified:
>     cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=166809&r1=166808&r2=166809&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Oct 26 15:22:11 2012
> @@ -2582,8 +2582,15 @@
>    }
>
>    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);
> +    }

Please add a comment with an explanation of why this is necessary.

-Eli



More information about the cfe-commits mailing list