diff --git a/clang/test/CXX/drs/dr124.cpp b/clang/test/CXX/drs/dr124.cpp new file mode 100644 index 0000000000000..c07beb11709c7 --- /dev/null +++ b/clang/test/CXX/drs/dr124.cpp @@ -0,0 +1,51 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -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 -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 -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 -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 -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 -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 -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 dr124 { // dr124: 2.7 + +extern void full_expr_fence() NOTHROW; + +struct A { + A() NOTHROW {} + ~A() NOTHROW {} +}; + +struct B { + B(A = A()) NOTHROW {} + ~B() NOTHROW {} +}; + +void f() { + full_expr_fence(); + B b[2]; + full_expr_fence(); +} + +// CHECK-LABEL: define {{.*}} void @dr124::f()() +// CHECK: call void @dr124::full_expr_fence() +// CHECK: br label %arrayctor.loop +// CHECK-LABEL: arrayctor.loop: +// CHECK: call void @dr124::A::A() +// CHECK: call void @dr124::B::B(dr124::A) +// CHECK: call void @dr124::A::~A() +// CHECK: br {{.*}}, label %arrayctor.cont, label %arrayctor.loop +// CHECK-LABEL: arrayctor.cont: +// CHECK: call void @dr124::full_expr_fence() +// CHECK: br label %arraydestroy.body +// CHECK-LABEL: arraydestroy.body: +// CHECK: call void @dr124::B::~B() +// CHECK-LABEL: } + + +} // namespace dr124 diff --git a/clang/test/CXX/drs/dr185.cpp b/clang/test/CXX/drs/dr185.cpp new file mode 100644 index 0000000000000..aff00f1a8764a --- /dev/null +++ b/clang/test/CXX/drs/dr185.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -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 -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 -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 -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 -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 -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 -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK + +namespace dr185 { // dr185: 2.7 +struct A { + mutable int value; + explicit A(int i) : value(i) {} + void mutate(int i) const { value = i; } +}; + +int foo() { + A const& t = A(1); + A n(t); + t.mutate(2); + return n.value; +} + +// CHECK-LABEL: define {{.*}} i32 @dr185::foo() +// CHECK: call void @dr185::A::A(int)(ptr {{[^,]*}} %ref.tmp, {{.*}}) +// CHECK: store ptr %ref.tmp, ptr %t +// CHECK-NOT: %t = +// CHECK: [[DR185_T:%.+]] = load ptr, ptr %t +// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{[^,]*}} %n, ptr {{[^,]*}} [[DR185_T]], {{.*}}) +// CHECK-LABEL: } +} // namespace dr185 diff --git a/clang/test/CXX/drs/dr193.cpp b/clang/test/CXX/drs/dr193.cpp new file mode 100644 index 0000000000000..c010dad50e403 --- /dev/null +++ b/clang/test/CXX/drs/dr193.cpp @@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -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 -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 -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 -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 -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 -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 -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 dr193 { // dr193: 2.7 +struct A { + ~A() NOTHROW {} +}; + +struct B { + ~B() NOTHROW {} +}; + +struct C { + ~C() NOTHROW {} +}; + +struct D : A { + B b; + ~D() NOTHROW { C c; } +}; + +void foo() { + D d; +} + +// skipping over D1 (complete object destructor) +// CHECK-LABEL: define {{.*}} void @dr193::D::~D(){{.*}} +// CHECK-LABEL: define {{.*}} void @dr193::D::~D(){{.*}} +// CHECK-NOT: call void @dr193::A::~A() +// CHECK-NOT: call void @dr193::B::~B() +// CHECK: call void @dr193::C::~C() +// CHECK: call void @dr193::B::~B() +// CHECK: call void @dr193::A::~A() +// CHECK-LABEL: } +} // namespace dr193 diff --git a/clang/test/CXX/drs/dr199.cpp b/clang/test/CXX/drs/dr199.cpp new file mode 100644 index 0000000000000..7517d79680c6f --- /dev/null +++ b/clang/test/CXX/drs/dr199.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -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 -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 -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 -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 -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 -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 -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 dr199 { // dr199: 2.8 +struct A { + ~A() NOTHROW {} +}; + +struct B { + ~B() NOTHROW {} +}; + +void foo() { + A(), B(); +} + +// CHECK-LABEL: define {{.*}} void @dr199::foo() +// CHECK-NOT: call void @dr199::A::~A() +// CHECK: call void @dr199::B::~B() +// CHECK: call void @dr199::A::~A() +// CHECK-LABEL: } +} // namespace dr199 diff --git a/clang/test/CXX/drs/dr1xx.cpp b/clang/test/CXX/drs/dr1xx.cpp index 1930de2f070a7..d55033cef1b64 100644 --- a/clang/test/CXX/drs/dr1xx.cpp +++ b/clang/test/CXX/drs/dr1xx.cpp @@ -306,7 +306,7 @@ namespace dr122 { // dr122: yes } // dr123: na -// dr124: dup 201 +// dr124 is in dr124.cpp // dr125: yes struct dr125_A { struct dr125_B {}; }; // #dr125_B @@ -1169,7 +1169,7 @@ namespace dr184 { // dr184: yes void h() { A().g(); } } -// dr185 FIXME: add codegen test +// dr185 is in dr185.cpp namespace dr187 { // dr187: sup 481 const int Z = 1; @@ -1184,6 +1184,7 @@ namespace dr188 { // dr188: yes } // dr190 FIXME: add codegen test for tbaa +// or implement C++20 std::is_layout_compatible and test it this way int dr191_j; namespace dr191 { // dr191: yes @@ -1215,7 +1216,7 @@ namespace dr191 { // dr191: yes } } -// dr193 FIXME: add codegen test +// dr193 is in dr193.cpp namespace dr194 { // dr194: yes struct A { @@ -1290,4 +1291,4 @@ namespace dr198 { // dr198: yes }; } -// dr199 FIXME: add codegen test +// dr199 is in dr199.cpp diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 4ce5c430a47c9..8f4ae23505f03 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -782,7 +782,7 @@

C++ defect report implementation status

124 CD1 Lifetime of temporaries in default initialization of class arrays - Duplicate of 201 + Clang 2.7 125 @@ -1148,7 +1148,7 @@

C++ defect report implementation status

185 TC1 "Named" temporaries and copy elision - Unknown + Clang 2.7 186 @@ -1196,7 +1196,7 @@

C++ defect report implementation status

193 TC1 Order of destruction of local automatics of destructor - Unknown + Clang 2.7 194 @@ -1232,7 +1232,7 @@

C++ defect report implementation status

199 CD1 Order of destruction of temporaries - Unknown + Clang 2.8 200