aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/Mangler.h4
-rw-r--r--lib/VMCore/Mangler.cpp7
2 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h
index 9b885d0549..3fe88c1126 100644
--- a/include/llvm/Support/Mangler.h
+++ b/include/llvm/Support/Mangler.h
@@ -19,7 +19,7 @@
#include <string>
namespace llvm {
-class StringRef;
+class Twine;
class Type;
class Module;
class Value;
@@ -112,7 +112,7 @@ public:
/// does this for you, so there's no point calling it on the result
/// from getValueName.
///
- std::string makeNameProper(StringRef x,
+ std::string makeNameProper(const Twine &Name,
ManglerPrefixTy PrefixTy = Mangler::Default);
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp
index 2f546b11e4..5783ddfba9 100644
--- a/lib/VMCore/Mangler.cpp
+++ b/lib/VMCore/Mangler.cpp
@@ -16,7 +16,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -32,8 +32,11 @@ static std::string MangleLetter(unsigned char C) {
/// makeNameProper - We don't want identifier names non-C-identifier characters
/// in them, so mangle them as appropriate.
///
-std::string Mangler::makeNameProper(StringRef X,
+std::string Mangler::makeNameProper(const Twine &TheName,
ManglerPrefixTy PrefixTy) {
+ SmallString<256> TmpData;
+ TheName.toVector(TmpData);
+ StringRef X = TmpData.str();
assert(!X.empty() && "Cannot mangle empty strings");
if (!UseQuotes) {