-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[C23] Accept an _Atomic underlying type #147802
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
Open
AaronBallman
wants to merge
9
commits into
llvm:main
Choose a base branch
from
AaronBallman:aballman-gh147736
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+140
−4
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e65fa6b
[C23] Accept an _Atomic underlying type
AaronBallman 8f5ce34
Move conversion to after the check for type dependence
AaronBallman 1df979f
Add a codegen test
AaronBallman 9ba10c7
Add a diagnostic
AaronBallman 45517ca
Add some FIXMEs
AaronBallman 358175b
Warn on cv-qualifiers, default to error for _Atomic
AaronBallman 1331d9b
Fix failing test
AaronBallman 45b75ff
Use enum_select; NFC
AaronBallman 168d828
Fix build
AaronBallman 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
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
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
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,13 @@ | ||
// RUN: %clang_cc1 -std=c23 -Wno-underlying-atomic-qualifier-ignored -ast-dump %s | FileCheck %s | ||
|
||
// The underlying type is the unqualified, non-atomic version of the type | ||
// specified. | ||
enum const_enum : const short { ConstE }; | ||
// CHECK: EnumDecl {{.*}} const_enum 'short' | ||
|
||
// These were previously being diagnosed as invalid underlying types. They | ||
// are valid; the _Atomic is stripped from the underlying type. | ||
enum atomic_enum1 : _Atomic(int) { AtomicE1 }; | ||
// CHECK: EnumDecl {{.*}} atomic_enum1 'int' | ||
enum atomic_enum2 : _Atomic long long { AtomicE2 }; | ||
// CHECK: EnumDecl {{.*}} atomic_enum2 'long long' |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// RUN: %clang_cc1 -std=c++11 -verify %s | ||
|
||
// expected-no-diagnostics | ||
enum class E : int const volatile { }; | ||
enum class E : int const volatile { }; // expected-warning {{'const' and 'volatile' qualifiers in enumeration underlying type ignored}} | ||
using T = __underlying_type(E); | ||
using T = int; |
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,26 @@ | ||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 | ||
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-error=underlying-atomic-qualifier-ignored -std=c23 %s -emit-llvm -o - | FileCheck %s | ||
|
||
// Ensure that an "atomic" underlying type has no actual atomic semantics | ||
// because the qualifier is stripped. | ||
|
||
enum E : _Atomic(int) { | ||
Foo | ||
}; | ||
|
||
// CHECK-LABEL: define {{.*}} void @test( | ||
// CHECK-SAME: i32 noundef [[E:%.*]]) #[[ATTR0:[0-9]+]] { | ||
// CHECK-NEXT: [[ENTRY:.*:]] | ||
// CHECK-NEXT: [[E_ADDR:%.*]] = alloca i32 | ||
// CHECK-NEXT: [[X:%.*]] = alloca i32 | ||
// CHECK-NEXT: store i32 [[E]], ptr [[E_ADDR]] | ||
// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[E_ADDR]] | ||
// CHECK-NEXT: store i32 [[TMP0]], ptr [[X]] | ||
// CHECK-NEXT: store i32 0, ptr [[E_ADDR]] | ||
// CHECK-NEXT: ret void | ||
// | ||
void test(enum E e) { | ||
int x = e; | ||
e = Foo; | ||
} | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.