mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
simplify some code to avoid string thrashing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -156,10 +156,12 @@ Constant *Module::getOrInsertFunction(const std::string &Name,
|
|||||||
|
|
||||||
// Okay, the function exists. Does it have externally visible linkage?
|
// Okay, the function exists. Does it have externally visible linkage?
|
||||||
if (F->hasInternalLinkage()) {
|
if (F->hasInternalLinkage()) {
|
||||||
// Rename the function.
|
// Clear the function's name.
|
||||||
F->setName(SymTab.getUniqueName(F->getName()));
|
F->setName("");
|
||||||
// Retry, now there won't be a conflict.
|
// 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
|
// If the function exists but has the wrong type, return a bitcast to the
|
||||||
|
Reference in New Issue
Block a user