mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Inline the now trivial setValueNameInternal function into both callers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14789 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -476,16 +476,6 @@ static void ResolveTypes(std::map<ValID, PATypeHolder> &LateResolveTypes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void setValueNameInternal(Value *V, const std::string &Name,
|
|
||||||
SymbolTable &ST) {
|
|
||||||
if (V->getType() == Type::VoidTy)
|
|
||||||
ThrowException("Can't assign name '" + Name + "' to value with void type!");
|
|
||||||
|
|
||||||
// Set the name
|
|
||||||
V->setName(Name, &ST);
|
|
||||||
}
|
|
||||||
|
|
||||||
// setValueName - Set the specified value to the name given. The name may be
|
// setValueName - Set the specified value to the name given. The name may be
|
||||||
// null potentially, in which case this is a noop. The string passed in is
|
// null potentially, in which case this is a noop. The string passed in is
|
||||||
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
// assumed to be a malloc'd string buffer, and is free'd by this function.
|
||||||
@@ -494,6 +484,9 @@ static void setValueName(Value *V, char *NameStr) {
|
|||||||
if (NameStr) {
|
if (NameStr) {
|
||||||
std::string Name(NameStr); // Copy string
|
std::string Name(NameStr); // Copy string
|
||||||
free(NameStr); // Free old string
|
free(NameStr); // Free old string
|
||||||
|
|
||||||
|
if (V->getType() == Type::VoidTy)
|
||||||
|
ThrowException("Can't assign name '" + Name+"' to value with void type!");
|
||||||
|
|
||||||
assert(inFunctionScope() && "Must be in function scope!");
|
assert(inFunctionScope() && "Must be in function scope!");
|
||||||
SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
|
SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
|
||||||
@@ -501,7 +494,8 @@ static void setValueName(Value *V, char *NameStr) {
|
|||||||
ThrowException("Redefinition of value named '" + Name + "' in the '" +
|
ThrowException("Redefinition of value named '" + Name + "' in the '" +
|
||||||
V->getType()->getDescription() + "' type plane!");
|
V->getType()->getDescription() + "' type plane!");
|
||||||
|
|
||||||
setValueNameInternal(V, Name, ST);
|
// Set the name.
|
||||||
|
V->setName(Name, &ST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,6 +509,8 @@ static void setValueName(Value *V, char *NameStr) {
|
|||||||
// for the typeplane, false is returned.
|
// for the typeplane, false is returned.
|
||||||
//
|
//
|
||||||
static bool setValueNameMergingDuplicates(Value *V, char *NameStr) {
|
static bool setValueNameMergingDuplicates(Value *V, char *NameStr) {
|
||||||
|
assert(V->getType() != Type::VoidTy && "Global or constant of type void?");
|
||||||
|
|
||||||
if (NameStr == 0) return false;
|
if (NameStr == 0) return false;
|
||||||
|
|
||||||
std::string Name(NameStr); // Copy string
|
std::string Name(NameStr); // Copy string
|
||||||
@@ -558,8 +554,9 @@ static bool setValueNameMergingDuplicates(Value *V, char *NameStr) {
|
|||||||
ThrowException("Redefinition of value named '" + Name + "' in the '" +
|
ThrowException("Redefinition of value named '" + Name + "' in the '" +
|
||||||
V->getType()->getDescription() + "' type plane!");
|
V->getType()->getDescription() + "' type plane!");
|
||||||
}
|
}
|
||||||
|
|
||||||
setValueNameInternal(V, Name, ST);
|
// Set the name.
|
||||||
|
V->setName(Name, &ST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user