-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] Add some CodeGen tests for CWG 1xx issues #80338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9c434c5
[clang] Add some CodeGen tests for CWG 1xx issues
Endilll 56c5045
Add test for CWG124
Endilll b52425c
Merge remote-tracking branch 'upstream/main' into cwg1xx-codegen
Endilll dcbca50
Merge remote-tracking branch 'upstream/main' into cwg1xx-codegen
Endilll 1a4e269
Merge remote-tracking branch 'upstream/main' into cwg1xx-codegen
Endilll File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i think this is doing what it says here.
Let @cor3ntin approve, but this looks right to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the
full_expr_fence
does anything here.The salient part of the test is L41.
That being said, I'm happy with that