aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-27 21:25:24 +0000
committerChris Lattner <sabre@nondot.org>2008-06-27 21:25:24 +0000
commit48cd712d4c84507d3098e795aebce8bd5ad05b14 (patch)
treecda1d637307eee610ac65f53772a04e0b35256b6 /lib/VMCore
parent8573986f3043bb9ed3754464dc0dabed0434b914 (diff)
downloadexternal_llvm-48cd712d4c84507d3098e795aebce8bd5ad05b14.zip
external_llvm-48cd712d4c84507d3098e795aebce8bd5ad05b14.tar.gz
external_llvm-48cd712d4c84507d3098e795aebce8bd5ad05b14.tar.bz2
simplify some code to avoid string thrashing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Module.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 893a5fd..94f5d81 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -156,10 +156,12 @@ Constant *Module::getOrInsertFunction(const std::string &Name,
// Okay, the function exists. Does it have externally visible linkage?
if (F->hasInternalLinkage()) {
- // Rename the function.
- F->setName(SymTab.getUniqueName(F->getName()));
+ // Clear the function's name.
+ F->setName("");
// Retry, now there won't be a conflict.
- return getOrInsertFunction(Name, Ty);
+ Constant *NewF = getOrInsertFunction(Name, Ty);
+ F->setName(&Name[0], Name.size());
+ return NewF;
}
// If the function exists but has the wrong type, return a bitcast to the