@@ -761,8 +761,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
761
761
// Compiler version introspection macros.
762
762
Builder.defineMacro (" __llvm__" ); // LLVM Backend
763
763
Builder.defineMacro (" __clang__" ); // Clang Frontend
764
- Builder.defineMacro (" __llvmmsvc__" ); // llvmmsvc Frontend
764
+ Builder.defineMacro (" __llvmmsvc__" ); // LLVM-MSVC Frontend
765
765
Builder.defineMacro (" _LLVM_MSC_VER" ); // LLVM-MSVC Frontend
766
+ Builder.defineMacro (" __llvmmsvc__private" ); // LLVM-MSVC private Frontend
767
+ Builder.defineMacro (" _LLVM_MSC_PRIVATE_VER" ); // LLVM-MSVC private Frontend
766
768
#define TOSTR2 (X ) #X
767
769
#define TOSTR (X ) TOSTR2(X)
768
770
Builder.defineMacro (" __clang_major__" , TOSTR (CLANG_VERSION_MAJOR));
@@ -1339,16 +1341,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
1339
1341
1340
1342
#ifdef _WIN32
1341
1343
// #define offsetof
1342
- Builder.append (" #ifndef offsetof" );
1343
- Builder.append (" #if defined _MSC_VER && !defined _CRT_USE_BUILTIN_OFFSETOF" );
1344
- Builder.append (" #ifdef __cplusplus" );
1345
- Builder.append (" #define offsetof(s,m) ((::size_t)&reinterpret_cast<char const volatile&>((((s*)0)->m)))" );
1346
- Builder.append (" #else" );
1347
- Builder.append (" #define offsetof(s,m) ((size_t)&(((s*)0)->m))" );
1348
- Builder.append (" #endif" );
1349
- Builder.append (" #else" );
1350
- Builder.append (" #define offsetof(s,m) __builtin_offsetof(s,m)" );
1351
- Builder.append (" #endif" );
1344
+ Builder.append (" #if !defined(offsetof) || __has_feature(modules)" );
1345
+ Builder.append (" #define offsetof(t, d) __builtin_offsetof(t, d)" );
1352
1346
Builder.append (" #endif" );
1353
1347
#endif
1354
1348
}
0 commit comments