On Tue, Nov 13, 2012 at 5:52 PM, David Blaikie <[email protected]> wrote:
> Author: dblaikie
> Date: Tue Nov 13 19:52:05 2012
> New Revision: 167906
>
> URL: http://llvm.org/viewvc/llvm-project?rev=167906&view=rev
> Log:
> Provide the correct mangling and linkage for certain unnamed nested classes.
>
> This corrects the mangling and linkage of classes (& their member functions) 
> in
> cases like this:
>
>   struct foo {
>     struct {
>       void func() { ... }
>     } x;
>   };
>
> we were accidentally giving this nested unnamed struct 'no' linkage where it
> should've had the linkage of the outer class. The mangling was incorrecty too,
> mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
> mangling of UtX_.
>
> This also fixes -Wunused-member-function which would incorrectly diagnose
> 'func' as unused due to it having no linkage & thus appearing to be TU-local
> when in fact it might be correctly used in another TU.
>
> Similar mangling should be applied to function local classes in similar cases
> but I've deferred that for a subsequent patch.
[...]
> Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=167906&r1=167905&r2=167906&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
> +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Tue Nov 13 19:52:05 2012
> @@ -1117,6 +1117,18 @@
>          break;
>        }
>      }
> +
> +    int UnnamedMangle = 
> Context.getASTContext().getUnnamedTagManglingNumber(TD);
> +    if (UnnamedMangle != -1) {
> +      Out << "Ut";
> +      if (UnnamedMangle != 0)
> +        Out << llvm::utostr(UnnamedMangle - 1);
> +      Out << '_';
> +      break;
> +    }
> +
> +    //assert(cast<RecordDecl>(RD)->isAnonymousStructOrUnion() && "Don't 
> mangle unnamed things as "
> +    //  "anonymous things");

Was this accidentally left behind?
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to