Add support for appending a suffix to the end of a mangled name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42071 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2007-09-17 22:39:32 +00:00
parent 30729b48d4
commit ecd9137758
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ public:
/// getValueName - Returns the mangled name of V, an LLVM Value, /// getValueName - Returns the mangled name of V, an LLVM Value,
/// in the current module. /// in the current module.
/// ///
std::string getValueName(const GlobalValue *V); std::string getValueName(const GlobalValue *V, const char *Suffix = "");
std::string getValueName(const Value *V); std::string getValueName(const Value *V);
/// makeNameProper - We don't want identifier names with ., space, or /// makeNameProper - We don't want identifier names with ., space, or

View File

@ -126,7 +126,7 @@ std::string Mangler::getValueName(const Value *V) {
} }
std::string Mangler::getValueName(const GlobalValue *GV) { std::string Mangler::getValueName(const GlobalValue *GV, const char * Suffix) {
// Check to see whether we've already named V. // Check to see whether we've already named V.
std::string &Name = Memo[GV]; std::string &Name = Memo[GV];
if (!Name.empty()) if (!Name.empty())
@ -143,7 +143,7 @@ std::string Mangler::getValueName(const GlobalValue *GV) {
static unsigned GlobalID = 0; static unsigned GlobalID = 0;
Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(GlobalID++); Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(GlobalID++);
} else if (!MangledGlobals.count(GV)) { } else if (!MangledGlobals.count(GV)) {
Name = makeNameProper(GV->getName(), Prefix); Name = makeNameProper(GV->getName() + Suffix, Prefix);
} else { } else {
unsigned TypeUniqueID = getTypeID(GV->getType()); unsigned TypeUniqueID = getTypeID(GV->getType());
Name = "l" + utostr(TypeUniqueID) + "_" + makeNameProper(GV->getName()); Name = "l" + utostr(TypeUniqueID) + "_" + makeNameProper(GV->getName());