aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-17 06:06:54 +0000
committerChris Lattner <sabre@nondot.org>2004-08-17 06:06:54 +0000
commit97f3e37f00a477ec55e4e3fa2e23a72d351b1aca (patch)
tree273638c7fbc0db4ba1cbc5cec3ab3087fbdaf8a2 /lib
parent2c2475296d55bd38281cba0c2b41ba3a897164dd (diff)
downloadexternal_llvm-97f3e37f00a477ec55e4e3fa2e23a72d351b1aca.zip
external_llvm-97f3e37f00a477ec55e4e3fa2e23a72d351b1aca.tar.gz
external_llvm-97f3e37f00a477ec55e4e3fa2e23a72d351b1aca.tar.bz2
Allow an arbitrary prefix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15865 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Mangler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp
index bf989b4..ed58da0 100644
--- a/lib/VMCore/Mangler.cpp
+++ b/lib/VMCore/Mangler.cpp
@@ -75,8 +75,7 @@ std::string Mangler::getValueName(const Value *V) {
if (gv && isa<Function>(gv) && cast<Function>(gv)->getIntrinsicID()) {
name = gv->getName(); // Is an intrinsic function
} else if (gv && !gv->hasInternalLinkage() && !MangledGlobals.count(gv)) {
- name = makeNameProper(gv->getName());
- if (AddUnderscorePrefix) name = "_" + name;
+ name = Prefix + makeNameProper(gv->getName());
} else {
// Non-global, or global with internal linkage / colliding name
// -> mangle.
@@ -115,8 +114,8 @@ void Mangler::InsertName(GlobalValue *GV,
}
-Mangler::Mangler(Module &m, bool addUnderscorePrefix)
- : M(m), AddUnderscorePrefix(addUnderscorePrefix), TypeCounter(0), Count(0) {
+Mangler::Mangler(Module &m, const char *prefix)
+ : M(m), Prefix(prefix), TypeCounter(0), Count(0) {
// Calculate which global values have names that will collide when we throw
// away type information.
std::map<std::string, GlobalValue*> Names;