diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-31 04:44:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-31 04:44:06 +0000 |
commit | 9e47ead5941de1383142249470366e51caa4460d (patch) | |
tree | 70e3d1cec526c6e9451f65eff94be859c054c12c /clang/CodeGen/CodeGenModule.cpp | |
parent | 1eec6601d9f3bcc7d571814cbb371600607baf01 (diff) | |
download | bcm5719-llvm-9e47ead5941de1383142249470366e51caa4460d.tar.gz bcm5719-llvm-9e47ead5941de1383142249470366e51caa4460d.zip |
Implement codegen support for lowering "library builtins" like __builtin_isinf
to their corresponding library routines (e.g. isinf). This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.
llvm-svn: 41634
Diffstat (limited to 'clang/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index a6a887f90fa..ec3d0affae5 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/CodeGen/CodeGenModule.cpp @@ -127,7 +127,11 @@ llvm::Function *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) { // and for the existing one to be turned into a constantexpr cast of the // builtin. In the case where the existing one is a static function, it // should just be renamed. - assert(getModule().getFunction(Name) == 0 && "FIXME: Name collision"); + if (llvm::Function *Existing = getModule().getFunction(Name)) { + if (Existing->getFunctionType() == Ty && Existing->hasExternalLinkage()) + return FunctionSlot = Existing; + assert(Existing == 0 && "FIXME: Name collision"); + } // FIXME: param attributes for sext/zext etc. return FunctionSlot = new llvm::Function(Ty, llvm::Function::ExternalLinkage, |