On Thu, May 05, 2011 at 12:25:33PM +0200, Joerg Sonnenberger wrote:
> On Wed, May 04, 2011 at 02:04:50AM +0200, Joerg Sonnenberger wrote:
> > the attached patch makes builtins that have been explicitly declared
> > with an assembler label honour it.
>
> There was an issue on Mac OS X not getting the name (not) mangled
> correctly. Attached is an updated patch.
Or now...
Joerg
Index: CodeGenModule.cpp
===================================================================
--- CodeGenModule.cpp (revision 130694)
+++ CodeGenModule.cpp (working copy)
@@ -1561,14 +1561,24 @@
"isn't a lib fn");
// Get the name, skip over the __builtin_ prefix (if necessary).
- const char *Name = Context.BuiltinInfo.GetName(BuiltinID);
- if (Context.BuiltinInfo.isLibFunction(BuiltinID))
- Name += 10;
+ llvm::StringRef Name;
+ GlobalDecl D(FD);
+ // If the builtin has been declared explicitly with an assembler label,
+ // use the mangled name. This differs from the plain label on platforms
+ // that prefix labels.
+ if (const AsmLabelAttr *ALA = FD->getAttr<AsmLabelAttr>())
+ Name = getMangledName(D);
+ else if (Context.BuiltinInfo.isLibFunction(BuiltinID))
+ Name = Context.BuiltinInfo.GetName(BuiltinID) + 10;
+ else
+ Name = Context.BuiltinInfo.GetName(BuiltinID);
+
+
const llvm::FunctionType *Ty =
cast<llvm::FunctionType>(getTypes().ConvertType(FD->getType()));
- return GetOrCreateLLVMFunction(Name, Ty, GlobalDecl(FD), /*ForVTable=*/false);
+ return GetOrCreateLLVMFunction(Name, Ty, D, /*ForVTable=*/false);
}
llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys,
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits