r175132 - Partially revert r175117 so that we don't break assumptions about how

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Feb 13 19:48:50 PST 2013


On 13 February 2013 22:31, Rafael Espindola <rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Wed Feb 13 21:31:26 2013
> New Revision: 175132
>
> URL: http://llvm.org/viewvc/llvm-project?rev=175132&view=rev
> Log:
> Partially revert r175117 so that we don't break assumptions about how
> static functions in extern "C" contexts are mangled. Should fix the
> bootstrap.

This is really ugly, but seems to be a common assumption, so I don't
think we can1t break it. I considered 3 options

* Giving C language linkage to static functions in extern C contexts.
I decided not to do this since it would then require more special
cases in the callers. For example, without extra care we would go back
to warning on a static returning non-POD if it defined in an extern C
context.
* Adding the restriction just to overloading (this patch).
* Changing the mangling only when the function is actually overloaded.
For example, in

extern "C" {
  static void foo() {
  }
  static void bar() {
  }
  static void bar(int x) {
  }
}

we would produce the symbols foo, _Z3barv and _Z3bari. I still like
the idea, but I could not find an easy way to detect in
shouldMangleDeclName if the function was overloaded or not.

Cheers,
Rafael



More information about the cfe-commits mailing list