aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2024-06-24 14:02:28 +0300
committerGitHub <noreply@github.com>2024-06-24 14:02:28 +0300
commit4e6c8f1d30b8516fc7205bbcc97a78a728215512 (patch)
treeaa465c1dc2aec3525a61e2816d2bafd99be42987 /clang/lib/Frontend/InitPreprocessor.cpp
parent3d8079229e7571a5912e880bf7a960d809c8ee96 (diff)
downloadllvm-4e6c8f1d30b8516fc7205bbcc97a78a728215512.zip
llvm-4e6c8f1d30b8516fc7205bbcc97a78a728215512.tar.gz
llvm-4e6c8f1d30b8516fc7205bbcc97a78a728215512.tar.bz2
[clang] [MinGW] Set a predefined __GXX_TYPEINFO_EQUALITY_INLINE=0 for MinGW targets (#96062)
libstdc++ requires this define to match what is predefined in GCC for the ABI of this platform; GCC hardcodes this define for all mingw configurations in gcc/config/i386/cygming.h. (It also defines __GXX_MERGED_TYPEINFO_NAMES=0, but that happens to match the defaults in libstdc++ headers, so there's no similar need to define it in Clang.) This fixes a Clang/libstdc++ interop issue discussed at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110572.
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 2d5c94c..55ec460 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -934,6 +934,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (LangOpts.GNUCVersion && LangOpts.CPlusPlus11)
Builder.defineMacro("__GXX_EXPERIMENTAL_CXX0X__");
+ if (TI.getTriple().isWindowsGNUEnvironment()) {
+ // Set ABI defining macros for libstdc++ for MinGW, where the
+ // default in libstdc++ differs from the defaults for this target.
+ Builder.defineMacro("__GXX_TYPEINFO_EQUALITY_INLINE", "0");
+ }
+
if (LangOpts.ObjC) {
if (LangOpts.ObjCRuntime.isNonFragile()) {
Builder.defineMacro("__OBJC2__");