-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] add -Wshift-bool warning to handle shifting of bool #127336
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 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
272385d
[Clang] add -Wshift-bool warning to handle shifting of bool
a-tarasyuk b521922
update release notes
a-tarasyuk 87707c5
update diagnostic groups
a-tarasyuk a777bf7
handle only right shift
a-tarasyuk 09081f4
Merge branch 'main' of https://github.com/llvm/llvm-project into feat…
a-tarasyuk 02184d0
cleanup
a-tarasyuk b6dd41f
Merge branch 'main' into feat/28334
a-tarasyuk 0ff841a
add additional test cases
a-tarasyuk 39614e7
Merge branch 'feat/28334' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk 00216ad
Merge branch 'main' of https://github.com/llvm/llvm-project into feat…
a-tarasyuk 068d04d
Merge branch 'main' into feat/28334
a-tarasyuk a9cad13
Merge branch 'main' into feat/28334
a-tarasyuk 0f17d1c
Merge branch 'main' into feat/28334
a-tarasyuk dada40d
update diagnostic message
a-tarasyuk 7f94350
avoid returning after diagnostic
a-tarasyuk bc2e562
Merge branch 'feat/28334' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk dd14c8b
Merge branch 'main' of https://github.com/llvm/llvm-project into feat…
a-tarasyuk 474414a
Merge branch 'main' into feat/28334
a-tarasyuk 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -Wshift-bool -verify %s | ||
|
||
void t() { | ||
int x = 10; | ||
bool y = true; | ||
|
||
bool a = y >> x; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} | ||
bool b = false >> x; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} | ||
bool c = y >> 5; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} | ||
bool d = y >> -1; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} | ||
bool e = y >> 0; // expected-warning {{right shifting a `bool` implicitly converts it to 'int'}} | ||
a-tarasyuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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.