[llvm] r240408 - Remove unused arguments and move ManglerPrefixTy to the implementation.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jun 23 07:11:09 PDT 2015
Author: rafael
Date: Tue Jun 23 09:11:09 2015
New Revision: 240408
URL: http://llvm.org/viewvc/llvm-project?rev=240408&view=rev
Log:
Remove unused arguments and move ManglerPrefixTy to the implementation.
Modified:
llvm/trunk/include/llvm/IR/Mangler.h
llvm/trunk/lib/IR/Mangler.cpp
Modified: llvm/trunk/include/llvm/IR/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Mangler.h?rev=240408&r1=240407&r2=240408&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Mangler.h (original)
+++ llvm/trunk/include/llvm/IR/Mangler.h Tue Jun 23 09:11:09 2015
@@ -25,14 +25,6 @@ template <typename T> class SmallVectorI
class Twine;
class Mangler {
-public:
- enum ManglerPrefixTy {
- Default, ///< Emit default string before each symbol.
- Private, ///< Emit "private" prefix before each symbol.
- LinkerPrivate ///< Emit "linker private" prefix before each symbol.
- };
-
-private:
/// We need to give global values the same name every time they are mangled.
/// This keeps track of the number we give to anonymous ones.
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
@@ -54,11 +46,9 @@ public:
/// Print the appropriate prefix and the specified name as the global variable
/// name. GVName must not be empty.
static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
- const DataLayout &DL,
- ManglerPrefixTy PrefixTy = Mangler::Default);
+ const DataLayout &DL);
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
- const Twine &GVName, const DataLayout &DL,
- ManglerPrefixTy PrefixTy = Mangler::Default);
+ const Twine &GVName, const DataLayout &DL);
};
} // End llvm namespace
Modified: llvm/trunk/lib/IR/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=240408&r1=240407&r2=240408&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Mangler.cpp (original)
+++ llvm/trunk/lib/IR/Mangler.cpp Tue Jun 23 09:11:09 2015
@@ -21,8 +21,16 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
+namespace {
+enum ManglerPrefixTy {
+ Default, ///< Emit default string before each symbol.
+ Private, ///< Emit "private" prefix before each symbol.
+ LinkerPrivate ///< Emit "linker private" prefix before each symbol.
+};
+}
+
static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
- Mangler::ManglerPrefixTy PrefixTy,
+ ManglerPrefixTy PrefixTy,
const DataLayout &DL, char Prefix) {
SmallString<256> TmpData;
StringRef Name = GVName.toStringRef(TmpData);
@@ -35,9 +43,9 @@ static void getNameWithPrefixImpl(raw_os
return;
}
- if (PrefixTy == Mangler::Private)
+ if (PrefixTy == Private)
OS << DL.getPrivateGlobalPrefix();
- else if (PrefixTy == Mangler::LinkerPrivate)
+ else if (PrefixTy == LinkerPrivate)
OS << DL.getLinkerPrivateGlobalPrefix();
if (Prefix != '\0')
@@ -47,19 +55,23 @@ static void getNameWithPrefixImpl(raw_os
OS << Name;
}
-void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
- const DataLayout &DL,
- ManglerPrefixTy PrefixTy) {
+static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
+ const DataLayout &DL,
+ ManglerPrefixTy PrefixTy) {
char Prefix = DL.getGlobalPrefix();
return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
}
+void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
+ const DataLayout &DL) {
+ return getNameWithPrefixImpl(OS, GVName, DL, Default);
+}
+
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
- const Twine &GVName, const DataLayout &DL,
- ManglerPrefixTy PrefixTy) {
+ const Twine &GVName, const DataLayout &DL) {
raw_svector_ostream OS(OutName);
char Prefix = DL.getGlobalPrefix();
- return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
+ return getNameWithPrefixImpl(OS, GVName, Default, DL, Prefix);
}
static bool hasByteCountSuffix(CallingConv::ID CC) {
@@ -95,12 +107,12 @@ static void addByteCountSuffix(raw_ostre
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
bool CannotUsePrivateLabel) const {
- ManglerPrefixTy PrefixTy = Mangler::Default;
+ ManglerPrefixTy PrefixTy = Default;
if (GV->hasPrivateLinkage()) {
if (CannotUsePrivateLabel)
- PrefixTy = Mangler::LinkerPrivate;
+ PrefixTy = LinkerPrivate;
else
- PrefixTy = Mangler::Private;
+ PrefixTy = Private;
}
const DataLayout &DL = GV->getParent()->getDataLayout();
@@ -112,7 +124,7 @@ void Mangler::getNameWithPrefix(raw_ostr
ID = NextAnonGlobalID++;
// Must mangle the global into a unique ID.
- getNameWithPrefix(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
+ getNameWithPrefixImpl(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
return;
}
More information about the llvm-commits
mailing list