Skip to content

Commit a86450e

Browse files
committed
[Clang] [Driver] use __cxa_atexit by default on Cygwin.
GCC on Cygwin and MSYS2 are built with --enable-__cxa_atexit. Adjust test to expect this change. Signed-off-by: Jeremy Drake <[email protected]>
1 parent bcac0f0 commit a86450e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7230,7 +7230,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
72307230
// -fuse-cxa-atexit is default.
72317231
if (!Args.hasFlag(
72327232
options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
7233-
!RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
7233+
!RawTriple.isOSAIX() &&
7234+
(!RawTriple.isOSWindows() ||
7235+
RawTriple.isWindowsCygwinEnvironment()) &&
72347236
((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
72357237
RawTriple.hasEnvironment())) ||
72367238
KernelOrKext)

clang/test/Driver/cxa-atexit.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// RUN: %clang -### -target armv7-unknown-windows-msvc -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
22
// RUN: %clang -### -target armv7-unknown-windows-itanium -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
33
// RUN: %clang -### -target armv7-unknown-windows-gnu -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
4-
// RUN: %clang -### -target armv7-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
4+
// RUN: %clang -### -target armv7-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-CYGWIN
55
// RUN: %clang -### -target i686-unknown-windows-msvc -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
66
// RUN: %clang -### -target i686-unknown-windows-itanium -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
77
// RUN: %clang -### -target i686-unknown-windows-gnu -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
8-
// RUN: %clang -### -target i686-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
8+
// RUN: %clang -### -target i686-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-CYGWIN
99
// RUN: %clang -### -target x86_64-unknown-windows-msvc -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
1010
// RUN: %clang -### -target x86_64-unknown-windows-itanium -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
1111
// RUN: %clang -### -target x86_64-unknown-windows-gnu -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
12-
// RUN: %clang -### -target x86_64-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-WINDOWS
12+
// RUN: %clang -### -target x86_64-unknown-windows-cygnus -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-CYGWIN
1313
// RUN: %clang -### -target hexagon-unknown-none -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-HEXAGON
1414
// RUN: %clang -### -target xcore-unknown-none -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-XCORE
1515
// RUN: %clang -### -target armv7-mti-none -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-MTI
@@ -21,6 +21,7 @@
2121
// RUN: %clang -### -target powerpc64-ibm-aix-xcoff -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-AIX
2222

2323
// CHECK-WINDOWS: "-fno-use-cxa-atexit"
24+
// CHECK-CYGWIN-NOT: "-fno-use-cxa-atexit"
2425
// CHECK-SOLARIS-NOT: "-fno-use-cxa-atexit"
2526
// CHECK-HEXAGON-NOT: "-fno-use-cxa-atexit"
2627
// CHECK-XCORE: "-fno-use-cxa-atexit"

0 commit comments

Comments
 (0)