summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/MC/MCAsmInfo.h8
-rw-r--r--lib/MC/MCAsmInfo.cpp2
-rw-r--r--lib/MC/MCAsmInfoCOFF.cpp2
-rw-r--r--lib/MC/MCAsmInfoDarwin.cpp2
-rw-r--r--lib/Target/Mangler.cpp11
-rw-r--r--lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp4
6 files changed, 12 insertions, 17 deletions
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 7a99394621..6dfb42c76a 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -115,9 +115,9 @@ namespace llvm {
/// LabelSuffix - This is appended to emitted labels.
const char *DebugLabelSuffix; // Defaults to ":"
- /// GlobalPrefix - If this is set to a non-empty string, it is prepended
- /// onto all global symbols. This is often used for "_" or ".".
- const char *GlobalPrefix; // Defaults to ""
+ /// If this is set to anything other than '\0', it is prepended
+ /// onto all global symbols. This is often used for '_'.
+ char GlobalPrefix; // Defaults to '\0'
/// PrivateGlobalPrefix - This prefix is used for globals like constant
/// pool entries that are completely private to the .s file and should not
@@ -428,7 +428,7 @@ namespace llvm {
return DebugLabelSuffix;
}
- const char *getGlobalPrefix() const {
+ char getGlobalPrefix() const {
return GlobalPrefix;
}
const char *getPrivateGlobalPrefix() const {
diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp
index 28f1c95164..a2ff92ff4f 100644
--- a/lib/MC/MCAsmInfo.cpp
+++ b/lib/MC/MCAsmInfo.cpp
@@ -41,7 +41,7 @@ MCAsmInfo::MCAsmInfo() {
CommentString = "#";
LabelSuffix = ":";
DebugLabelSuffix = ":";
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".";
LinkerPrivateGlobalPrefix = "";
InlineAsmStart = "APP";
diff --git a/lib/MC/MCAsmInfoCOFF.cpp b/lib/MC/MCAsmInfoCOFF.cpp
index 9d9f98e72b..54ae3a272d 100644
--- a/lib/MC/MCAsmInfoCOFF.cpp
+++ b/lib/MC/MCAsmInfoCOFF.cpp
@@ -18,7 +18,7 @@ using namespace llvm;
void MCAsmInfoCOFF::anchor() { }
MCAsmInfoCOFF::MCAsmInfoCOFF() {
- GlobalPrefix = "_";
+ GlobalPrefix = '_';
// MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
// alignment.
COMMDirectiveAlignmentIsInBytes = false;
diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp
index 704c8161f8..8a021ce3ae 100644
--- a/lib/MC/MCAsmInfoDarwin.cpp
+++ b/lib/MC/MCAsmInfoDarwin.cpp
@@ -23,7 +23,7 @@ void MCAsmInfoDarwin::anchor() { }
MCAsmInfoDarwin::MCAsmInfoDarwin() {
// Common settings for all Darwin targets.
// Syntax:
- GlobalPrefix = "_";
+ GlobalPrefix = '_';
PrivateGlobalPrefix = "L";
LinkerPrivateGlobalPrefix = "l";
HasSingleParameterDotFile = false;
diff --git a/lib/Target/Mangler.cpp b/lib/Target/Mangler.cpp
index 5430d50945..c41a0f3591 100644
--- a/lib/Target/Mangler.cpp
+++ b/lib/Target/Mangler.cpp
@@ -47,14 +47,9 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
}
- const char *Prefix = MAI->getGlobalPrefix();
- if (Prefix[0] == 0)
- ; // Common noop, no prefix.
- else if (Prefix[1] == 0)
- OutName.push_back(Prefix[0]); // Common, one character prefix.
- else
- // Arbitrary length prefix.
- OutName.append(Prefix, Prefix+strlen(Prefix));
+ char Prefix = MAI->getGlobalPrefix();
+ if (Prefix != '\0')
+ OutName.push_back(Prefix);
}
// If this is a simple string that doesn't need escaping, just append it.
diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
index 3861e1ce29..45f22a1366 100644
--- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
@@ -128,7 +128,7 @@ void X86MCAsmInfoMicrosoft::anchor() { }
X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
if (Triple.getArch() == Triple::x86_64) {
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".L";
}
@@ -143,7 +143,7 @@ void X86MCAsmInfoGNUCOFF::anchor() { }
X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
if (Triple.getArch() == Triple::x86_64) {
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".L";
}