[cfe-commits] r57127 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/TargetInfo.cpp lib/Lex/Preprocessor.cpp
Chris Lattner
sabre at nondot.org
Sun Oct 5 12:22:39 PDT 2008
Author: lattner
Date: Sun Oct 5 14:22:37 2008
New Revision: 57127
URL: http://llvm.org/viewvc/llvm-project?rev=57127&view=rev
Log:
Implement PR2773, support for __USER_LABEL_PREFIX__
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=57127&r1=57126&r2=57127&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Oct 5 14:22:37 2008
@@ -44,7 +44,7 @@
unsigned char LongWidth, LongAlign;
unsigned char LongLongWidth, LongLongAlign;
const char *DescriptionString;
-
+ const char *UserLabelPrefix;
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
// TargetInfo Constructor. Default initializes all fields.
@@ -141,6 +141,14 @@
return 64;
}
+ /// getUserLabelPrefix - This returns the default value of the
+ /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by
+ /// default. On most platforms this is "_", but it is "" on some, and "." on
+ /// others.
+ const char *getUserLabelPrefix() const {
+ return UserLabelPrefix;
+ }
+
///===---- Other target property query methods --------------------------===//
/// getTargetDefines - Appends the target-specific #define values for this
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=57127&r1=57126&r2=57127&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sun Oct 5 14:22:37 2008
@@ -39,6 +39,7 @@
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.
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=57127&r1=57126&r2=57127&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Sun Oct 5 14:22:37 2008
@@ -425,6 +425,13 @@
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);
More information about the cfe-commits
mailing list