[cfe-dev] merging of FunctionDecl's
Douglas Gregor
dgregor at apple.com
Wed Oct 28 09:32:17 PDT 2009
On Oct 28, 2009, at 5:43 AM, Roman Divacky wrote:
> Hi,
>
> example code:
>
> int func(void); (1)
> extern int func (void) __asm__ ("FUNC"); (2)
>
> int func(void) {
> return 42;
> }
>
>
> this piece of code has two declarators (1 and 2). When clang decides
> what symbol name the code goes like this:
>
> CodeGenModule::GetAddrOfFunction
>
> return GetOrCreateLLVMFunction(getMangledName(GD), Ty, GD);
>
>
> the getMangledName() calls
>
> if (!mangleName(getMangleContext(), ND, Out)) {
>
> which creates CXXNameMangler and tries to mangle the name via it:
>
> CXXNameMangler Mangler(Context, os);
> if (!Mangler.mangle(cast<NamedDecl>(D->getCanonicalDecl())))
> return false;
This is actually this issue. We should be mangling based on the
declaration we're given, not based on the canonical declaration (which
is the first declaration and, therefore, does not have the attribute).
Fixed here:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20091026/022863.html
- Doug
More information about the cfe-dev
mailing list