aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-05 19:22:37 +0000
committerChris Lattner <sabre@nondot.org>2008-10-05 19:22:37 +0000
commit3fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99 (patch)
tree9de6dd64864634ad57a605b0e67c8ac3acac9cc8 /lib
parent8223b1d05fc6f46e76bb06d836c1e6dec764e65b (diff)
Implement PR2773, support for __USER_LABEL_PREFIX__
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Basic/TargetInfo.cpp1
-rw-r--r--lib/Lex/Preprocessor.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 8a11925e06..20692ba5b1 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -39,6 +39,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64";
+ UserLabelPrefix = "_";
}
// Out of line virtual dtor for TargetInfo.
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 458eca640a..12f63d6444 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -425,6 +425,13 @@ static void InitializePredefinedMacros(Preprocessor &PP,
Buf.push_back('\n');
}
+ if (const char *Prefix = PP.getTargetInfo().getUserLabelPrefix()) {
+ llvm::SmallString<20> TmpStr;
+ TmpStr += "__USER_LABEL_PREFIX__=";
+ TmpStr += Prefix;
+ DefineBuiltinMacro(Buf, TmpStr.c_str());
+ }
+
// Get the target #defines.
PP.getTargetInfo().getTargetDefines(Buf);