@@ -1099,50 +1099,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
1099
1099
TI.getTargetDefines (LangOpts, Builder);
1100
1100
}
1101
1101
1102
- // / Initialize macros based on AuxTargetInfo.
1103
- static void InitializePredefinedAuxMacros (const TargetInfo &AuxTI,
1104
- const LangOptions &LangOpts,
1105
- MacroBuilder &Builder) {
1106
- auto AuxTriple = AuxTI.getTriple ();
1107
-
1108
- // Define basic target macros needed by at least bits/wordsize.h and
1109
- // bits/mathinline.h.
1110
- // On PowerPC, explicitely set _CALL_ELF macro needed for gnu/stubs.h.
1111
- switch (AuxTriple.getArch ()) {
1112
- case llvm::Triple::x86_64:
1113
- Builder.defineMacro (" __x86_64__" );
1114
- break ;
1115
- case llvm::Triple::ppc64:
1116
- Builder.defineMacro (" __powerpc64__" );
1117
- Builder.defineMacro (" _CALL_ELF" , " 1" );
1118
- break ;
1119
- case llvm::Triple::ppc64le:
1120
- Builder.defineMacro (" __powerpc64__" );
1121
- Builder.defineMacro (" _CALL_ELF" , " 2" );
1122
- break ;
1123
- default :
1124
- break ;
1125
- }
1126
-
1127
- // libc++ needs to find out the object file format and threading API.
1128
- if (AuxTriple.getOS () == llvm::Triple::Linux) {
1129
- Builder.defineMacro (" __ELF__" );
1130
- Builder.defineMacro (" __linux__" );
1131
- Builder.defineMacro (" __gnu_linux__" );
1132
- // Used in features.h. If this is omitted, math.h doesn't declare float
1133
- // versions of the functions in bits/mathcalls.h.
1134
- if (LangOpts.CPlusPlus )
1135
- Builder.defineMacro (" _GNU_SOURCE" );
1136
- } else if (AuxTriple.isOSDarwin ()) {
1137
- Builder.defineMacro (" __APPLE__" );
1138
- Builder.defineMacro (" __MACH__" );
1139
- } else if (AuxTriple.isOSWindows ()) {
1140
- Builder.defineMacro (" _WIN32" );
1141
- if (AuxTriple.isWindowsGNUEnvironment ())
1142
- Builder.defineMacro (" __MINGW32__" );
1143
- }
1144
- }
1145
-
1146
1102
// / InitializePreprocessor - Initialize the preprocessor getting it and the
1147
1103
// / environment ready to process a single file. This returns true on error.
1148
1104
// /
@@ -1164,9 +1120,13 @@ void clang::InitializePreprocessor(
1164
1120
1165
1121
// Install things like __POWERPC__, __GNUC__, etc into the macro table.
1166
1122
if (InitOpts.UsePredefines ) {
1167
- InitializePredefinedMacros (PP.getTargetInfo (), LangOpts, FEOpts, Builder);
1123
+ // FIXME: This will create multiple definitions for most of the predefined
1124
+ // macros. This is not the right way to handle this.
1168
1125
if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice ) && PP.getAuxTargetInfo ())
1169
- InitializePredefinedAuxMacros (*PP.getAuxTargetInfo (), LangOpts, Builder);
1126
+ InitializePredefinedMacros (*PP.getAuxTargetInfo (), LangOpts, FEOpts,
1127
+ Builder);
1128
+
1129
+ InitializePredefinedMacros (PP.getTargetInfo (), LangOpts, FEOpts, Builder);
1170
1130
1171
1131
// Install definitions to make Objective-C++ ARC work well with various
1172
1132
// C++ Standard Library implementations.
0 commit comments