Rename Mangler linkage enums to something less gross.

llvm-svn: 76456
This commit is contained in:
Bill Wendling 2009-07-20 19:41:27 +00:00
parent 25ea06491e
commit 0407ebb4f7
4 changed files with 19 additions and 23 deletions

View File

@ -27,9 +27,9 @@ class GlobalValue;
class Mangler {
public:
enum ManglerPrefixTy {
DefaultPrefixTy, ///< Emit default string before each symbol.
PrivatePrefixTy, ///< Emit "private" prefix before each symbol.
LinkerPrivatePrefixTy ///< Emit "linker private" prefix before each symbol.
Default, ///< Emit default string before each symbol.
Private, ///< Emit "private" prefix before each symbol.
LinkerPrivate ///< Emit "linker private" prefix before each symbol.
};
private:
@ -103,7 +103,7 @@ public:
/// from getValueName.
///
std::string makeNameProper(const std::string &x,
ManglerPrefixTy PrefixTy = DefaultPrefixTy);
ManglerPrefixTy PrefixTy = Mangler::Default);
};
} // End llvm namespace

View File

@ -93,14 +93,10 @@ namespace {
void Init(const std::string &GV, Mangler *Mang) {
// Already initialized.
if (!Stub.empty()) return;
Stub = Mang->makeNameProper(GV + "$stub",
Mangler::PrivatePrefixTy);
LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr",
Mangler::PrivatePrefixTy);
SLP = Mang->makeNameProper(GV + "$slp",
Mangler::PrivatePrefixTy);
SCV = Mang->makeNameProper(GV + "$scv",
Mangler::PrivatePrefixTy);
Stub = Mang->makeNameProper(GV + "$stub", Mangler::Private);
LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr", Mangler::Private);
SLP = Mang->makeNameProper(GV + "$slp", Mangler::Private);
SCV = Mang->makeNameProper(GV + "$scv", Mangler::Private);
}
};

View File

@ -71,11 +71,11 @@ namespace {
// Already initialized.
if (!Stub.empty()) return;
Stub = Mang->makeNameProper(GV + "$stub",
Mangler::PrivatePrefixTy);
Mangler::Private);
LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr",
Mangler::PrivatePrefixTy);
Mangler::Private);
AnonSymbol = Mang->makeNameProper(GV + "$stub$tmp",
Mangler::PrivatePrefixTy);
Mangler::Private);
}
};

View File

@ -60,9 +60,9 @@ std::string Mangler::makeNameProper(const std::string &X,
if (NeedPrefix) {
Result = Prefix + Result;
if (PrefixTy == PrivatePrefixTy)
if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
else if (PrefixTy == LinkerPrivatePrefixTy)
else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
}
@ -98,9 +98,9 @@ std::string Mangler::makeNameProper(const std::string &X,
Result = Prefix + X;
if (PrefixTy == PrivatePrefixTy)
if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
else if (PrefixTy == LinkerPrivatePrefixTy)
else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
return Result;
@ -121,9 +121,9 @@ std::string Mangler::makeNameProper(const std::string &X,
if (NeedPrefix) {
Result = Prefix + Result;
if (PrefixTy == PrivatePrefixTy)
if (PrefixTy == Mangler::Private)
Result = PrivatePrefix + Result;
else if (PrefixTy == LinkerPrivatePrefixTy)
else if (PrefixTy == Mangler::LinkerPrivate)
Result = LinkerPrivatePrefix + Result;
}
@ -142,8 +142,8 @@ std::string Mangler::getMangledName(const GlobalValue *GV, const char *Suffix,
"Intrinsic functions cannot be mangled by Mangler");
ManglerPrefixTy PrefixTy =
(GV->hasPrivateLinkage() || ForcePrivate) ? PrivatePrefixTy :
GV->hasLinkerPrivateLinkage() ? LinkerPrivatePrefixTy : DefaultPrefixTy;
(GV->hasPrivateLinkage() || ForcePrivate) ? Mangler::Private :
GV->hasLinkerPrivateLinkage() ? Mangler::LinkerPrivate : Mangler::Default;
if (GV->hasName())
return makeNameProper(GV->getName() + Suffix, PrefixTy);