[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread Vlad Serebrennikov via cfe-commits


@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK

Endilll wrote:

> We should have some reason to believe it increases test coverage, and we 
> might want to consider splitting those tests out into their own file so we 
> don't run 100 DR tests in two optimization modes for every standard version 
> we're testing.

But... every codegen tests is in its own file already because of an entirely 
different concern. I don't see us being able to combine them into a single file 
for foreseeable future. So running 100 DRs with those additional flags is not 
on the table.

https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread Vlad Serebrennikov via cfe-commits


@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+namespace dr292 { // dr292: 2.9

Endilll wrote:

I updated PR description to mention that resolution to 292 has been superseded 
by P0145R3. The latter is the wording I'm testing: we're making sure that we 
pass to deallocation function what was returned by allocation function, and 
making sure that potentially-throwing expression is evaluated in-between.

In `new A(no_except())` initializer can't throw, and there's no need figure out 
what to pass to deallocation function, so I consider it out of scope of the CWG 
issue.

https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll edited 
https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread via cfe-commits


@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+

cor3ntin wrote:

Way too many tests!

https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread via cfe-commits


@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+#if __cplusplus == 199711L
+#define NOTHROW throw()
+#else
+#define NOTHROW noexcept(true)
+#endif
+
+namespace dr201 { // dr201: 2.8

cor3ntin wrote:

What is tested here?
My understanding is that this issue deal with the sequence of destructions in 

```cpp
auto foo[2] = {A(temp()), B(temp())};
```

https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread via cfe-commits


@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK

cor3ntin wrote:

This is way too many tests imo!

https://github.com/llvm/llvm-project/pull/80823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Vlad Serebrennikov (Endilll)


Changes

This patch covers CWG issues
[201](https://cplusplus.github.io/CWG/issues/201.html),
[210](https://cplusplus.github.io/CWG/issues/210.html),
[292](https://cplusplus.github.io/CWG/issues/292.html).

[CWG208](https://cplusplus.github.io/CWG/issues/208.html) is not covered, as it 
actually requires a libcxxabi test.

---
Full diff: https://github.com/llvm/llvm-project/pull/80823.diff


5 Files Affected:

- (added) clang/test/CXX/drs/dr201.cpp (+43) 
- (added) clang/test/CXX/drs/dr210.cpp (+41) 
- (added) clang/test/CXX/drs/dr292.cpp (+38) 
- (modified) clang/test/CXX/drs/dr2xx.cpp (+3-3) 
- (modified) clang/www/cxx_dr_status.html (+4-4) 


``diff
diff --git a/clang/test/CXX/drs/dr201.cpp b/clang/test/CXX/drs/dr201.cpp
new file mode 100644
index 00..48495d337e00ff
--- /dev/null
+++ b/clang/test/CXX/drs/dr201.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+#if __cplusplus == 199711L
+#define NOTHROW throw()
+#else
+#define NOTHROW noexcept(true)
+#endif
+
+namespace dr201 { // dr201: 2.8
+
+struct A {
+  ~A() NOTHROW {}
+};
+
+struct B {
+  B(A) NOTHROW {}
+  ~B() NOTHROW {}
+};
+
+void foo() {
+  B b = A();
+}
+
+// CHECK-LABEL: define {{.*}} void @dr201::foo()
+// CHECK: call void @dr201::A::~A()
+// CHECK: call void @dr201::B::~B()
+// CHECK-LABEL: }
+
+} // namespace dr201
diff --git a/clang/test/CXX/drs/dr210.cpp b/clang/test/CXX/drs/dr210.cpp
new file mode 100644
index 00..c19771229596f1
--- /dev/null
+++ b/clang/test/CXX/drs/dr210.cpp
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptio

[clang-tools-extra] [clang] [llvm] [Clang] Add some CodeGen tests for CWG 2xx issues (PR #80823)

2024-02-06 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll created 
https://github.com/llvm/llvm-project/pull/80823

This patch covers CWG issues
[201](https://cplusplus.github.io/CWG/issues/201.html),
[210](https://cplusplus.github.io/CWG/issues/210.html),
[292](https://cplusplus.github.io/CWG/issues/292.html).

[CWG208](https://cplusplus.github.io/CWG/issues/208.html) is not covered, as it 
actually requires a libcxxabi test.

>From 560713b5d45236956198654a10e0795eb56cad7b Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Tue, 6 Feb 2024 13:23:36 +0300
Subject: [PATCH] [Clang] Add some CodeGen tests for CWG 2xx issues

This patch covers CWG issues
[201](https://cplusplus.github.io/CWG/issues/201.html),
[210](https://cplusplus.github.io/CWG/issues/210.html),
[292](https://cplusplus.github.io/CWG/issues/292.html).

[CWG208](https://cplusplus.github.io/CWG/issues/208.html) is not covered, as it 
actually requires a libcxxabi test.
---
 clang/test/CXX/drs/dr201.cpp | 43 
 clang/test/CXX/drs/dr210.cpp | 41 ++
 clang/test/CXX/drs/dr292.cpp | 38 +++
 clang/test/CXX/drs/dr2xx.cpp |  6 ++---
 clang/www/cxx_dr_status.html |  8 +++
 5 files changed, 129 insertions(+), 7 deletions(-)
 create mode 100644 clang/test/CXX/drs/dr201.cpp
 create mode 100644 clang/test/CXX/drs/dr210.cpp
 create mode 100644 clang/test/CXX/drs/dr292.cpp

diff --git a/clang/test/CXX/drs/dr201.cpp b/clang/test/CXX/drs/dr201.cpp
new file mode 100644
index 0..48495d337e00f
--- /dev/null
+++ b/clang/test/CXX/drs/dr201.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O0 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm 
-disable-llvm-passes -O3 -o - -fexceptions -fcxx-exceptions -pedantic-errors | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
+
+#if __cplusplus == 199711L
+#define NOTHROW throw()
+#else
+#define NOTHROW noexcept(true)
+#endif
+
+namespace dr201 { // dr201: 2.8
+
+struct A {
+  ~A() NOTHROW {}
+};
+
+struct B {
+  B(A) NOTHROW {}
+  ~B() NOTHROW {}
+};
+
+void foo() {
+  B b = A();
+}
+
+// CHECK-LABEL: define {{.*}} void @dr201::foo()
+// CHECK: call void @dr201::A::~A()
+// CHECK: call void @dr201::B::~B()
+// CHECK-LABEL: }
+
+} // namespace dr201
diff --git a/clang/test/CXX/drs/dr210.cpp b/clang/test/CXX/drs/dr21