[clang] 0277a24 - [clang][test] Update -fc++-abi tests
Leonard Chan via cfe-commits
cfe-commits at lists.llvm.org
Tue May 4 15:53:20 PDT 2021
Author: Leonard Chan
Date: 2021-05-04T15:53:00-07:00
New Revision: 0277a24f4bbac284ba7a2ace7eeefdf6305e7f69
URL: https://github.com/llvm/llvm-project/commit/0277a24f4bbac284ba7a2ace7eeefdf6305e7f69
DIFF: https://github.com/llvm/llvm-project/commit/0277a24f4bbac284ba7a2ace7eeefdf6305e7f69.diff
LOG: [clang][test] Update -fc++-abi tests
This attempts to move driver tests out of Frontend and to Driver, separates
RUNs that should fail from RUNs that should succeed, and prevent creating
output files or dumping output.
Differential Revision: https://reviews.llvm.org/D101867
Added:
clang/test/Driver/cxx-abi-flag.cpp
clang/test/Frontend/valid-cxx-abi.cpp
Modified:
clang/test/Frontend/invalid-cxx-abi.cpp
Removed:
################################################################################
diff --git a/clang/test/Driver/cxx-abi-flag.cpp b/clang/test/Driver/cxx-abi-flag.cpp
new file mode 100644
index 000000000000..e6b13dbaf4e4
--- /dev/null
+++ b/clang/test/Driver/cxx-abi-flag.cpp
@@ -0,0 +1,11 @@
+// Ensure that the driver flag is propagated to cc1.
+// RUN: %clang -### -fc++-abi=itanium -target x86_64-unknown-linux-gnu %s \
+// RUN: 2>&1 | FileCheck %s -check-prefix=ITANIUM
+// RUN: %clang -### -fc++-abi=fuchsia -target x86_64-unknown-fuchsia %s \
+// RUN: 2>&1 | FileCheck %s -check-prefix=FUCHSIA
+// RUN: %clang -### -fc++-abi=microsoft -target x86_64-unknown-windows-msvc %s \
+// RUN: 2>&1 | FileCheck %s -check-prefix=MICROSOFT
+//
+// ITANIUM: -fc++-abi=itanium
+// FUCHSIA: -fc++-abi=fuchsia
+// MICROSOFT: -fc++-abi=microsoft
diff --git a/clang/test/Frontend/invalid-cxx-abi.cpp b/clang/test/Frontend/invalid-cxx-abi.cpp
index 2bc0aac52cc7..df1ea9463670 100644
--- a/clang/test/Frontend/invalid-cxx-abi.cpp
+++ b/clang/test/Frontend/invalid-cxx-abi.cpp
@@ -1,24 +1,9 @@
-// REQUIRES: x86-registered-target
-
-// These should succeed.
-// RUN: %clang -c -fc++-abi=itanium -target x86_64-unknown-linux-gnu %s
-// RUN: %clang -c -fc++-abi=fuchsia -target x86_64-unknown-fuchsia %s
-// RUN: %clang -c -fc++-abi=microsoft -target x86_64-windows-msvc %s
-// RUN: %clang_cc1 -fc++-abi=itanium -triple x86_64-unknown-linux-gnu %s
-// RUN: %clang_cc1 -fc++-abi=fuchsia -triple x86_64-unknown-fuchsia %s
-// RUN: %clang_cc1 -fc++-abi=microsoft -triple x86_64-windows-msvc %s
-
-// RUN: not %clang -c -fc++-abi=InvalidABI %s 2>&1 | FileCheck %s -check-prefix=INVALID
-// RUN: not %clang -c -fc++-abi=Fuchsia %s 2>&1 | FileCheck %s -check-prefix=CASE-SENSITIVE
-// RUN: not %clang_cc1 -fc++-abi=InvalidABI %s 2>&1 | FileCheck %s -check-prefix=INVALID
-// RUN: not %clang_cc1 -fc++-abi=Fuchsia %s 2>&1 | FileCheck %s -check-prefix=CASE-SENSITIVE
+// These shouldn't be valid -fc++-abi values.
+// RUN: not %clang_cc1 -S -emit-llvm -o /dev/null -fc++-abi=InvalidABI %s 2>&1 | FileCheck %s -check-prefix=INVALID
+// RUN: not %clang_cc1 -S -emit-llvm -o /dev/null -fc++-abi=Fuchsia %s 2>&1 | FileCheck %s -check-prefix=CASE-SENSITIVE
// INVALID: error: Invalid C++ ABI name 'InvalidABI'
// CASE-SENSITIVE: error: Invalid C++ ABI name 'Fuchsia'
-// The flag is propgated from the driver to cc1.
-// RUN: %clang -fc++-abi=InvalidABI %s -### 2>&1 | FileCheck %s -check-prefix=CC1-FLAG
-// CC1-FLAG: -fc++-abi=InvalidABI
-
// Some C++ ABIs are not supported on some platforms.
-// RUN: not %clang_cc1 -c -fc++-abi=fuchsia -triple i386 %s 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-FUCHSIA
+// RUN: not %clang_cc1 -S -emit-llvm -o /dev/null -fc++-abi=fuchsia -triple i386 %s 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-FUCHSIA
// UNSUPPORTED-FUCHSIA: error: C++ ABI 'fuchsia' is not supported on target triple 'i386'
diff --git a/clang/test/Frontend/valid-cxx-abi.cpp b/clang/test/Frontend/valid-cxx-abi.cpp
new file mode 100644
index 000000000000..99f8dc869e0d
--- /dev/null
+++ b/clang/test/Frontend/valid-cxx-abi.cpp
@@ -0,0 +1,4 @@
+// These should be valid cxx abi flags for these targets.
+// RUN: %clang_cc1 -fc++-abi=itanium -triple x86_64-unknown-linux-gnu %s -S -emit-llvm -o /dev/null
+// RUN: %clang_cc1 -fc++-abi=fuchsia -triple x86_64-unknown-fuchsia %s -S -emit-llvm -o /dev/null
+// RUN: %clang_cc1 -fc++-abi=microsoft -triple x86_64-windows-msvc %s -S -emit-llvm -o /dev/null
More information about the cfe-commits
mailing list