@@ -761,8 +761,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
761761 // Compiler version introspection macros.
762762 Builder.defineMacro (" __llvm__" ); // LLVM Backend
763763 Builder.defineMacro (" __clang__" ); // Clang Frontend
764- Builder.defineMacro (" __llvmmsvc__" ); // llvmmsvc Frontend
764+ Builder.defineMacro (" __llvmmsvc__" ); // LLVM-MSVC Frontend
765765 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
766768#define TOSTR2 (X ) #X
767769#define TOSTR (X ) TOSTR2(X)
768770 Builder.defineMacro (" __clang_major__" , TOSTR (CLANG_VERSION_MAJOR));
@@ -1339,16 +1341,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
13391341
13401342#ifdef _WIN32
13411343 // #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)" );
13521346 Builder.append (" #endif" );
13531347#endif
13541348}
0 commit comments