[patches] Alternatives for static functions in extern C contexts

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Feb 20 15:19:35 PST 2013


Ping. Any preferences?

On 15 February 2013 10:08, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> I have changed llvm so that it doesn't depend on the mangling of
> static functions in extern C contexts. Now we should decide what to do
> in clang.
>
> I have attached two options on how to handle
>
> extern "C" {
>   static void foo();
> }
>
> The assign_c_language_linkage patch assigns C language linkage to any
> function or variable with linkage, instead of just the ones with
> external linkage. It looks like this is what gcc does.
>
> The mangle_static_extern_c implements the current letter of the
> standard, which requires some mangling of static functions. We can try
> to improve it so that given
>
> extern "C" {
>   static void foo() {
>   }
>   static void bar() {
>   }
>   static void bar(int x) {
>   }
> }
>
> it produces the symbols foo, _Z3barv and _Z3bari, but it doesn't look
> trivial to find out in shouldMangleDeclName if a function is
> overloaded or not.
>
> Cheers,
> Rafael




More information about the cfe-commits mailing list