-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[clang-tidy] Add fix-it for C-style cast of nullptr #173159
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
base: main
Are you sure you want to change the base?
Changes from all commits
c44ca1e
0715c6c
e66f785
453e29f
3dccf96
d699397
abc62a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -544,6 +544,10 @@ Changes in existing checks | |
| on Windows when the check was enabled with a 32-bit :program:`clang-tidy` | ||
| binary. | ||
|
|
||
| - Improved :doc:`modernize-avoid-c-style-cast | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Clang-Tidy documentations, we want entries in |
||
| <clang-tidy/checks/modernize/avoid-c-style-cast>` by providing correct fixes | ||
| for C-style casts of nullptr. | ||
|
|
||
| - Improved :doc:`modernize-use-override | ||
| <clang-tidy/checks/modernize/use-override>` by fixing an issue where | ||
| the check would sometimes suggest inserting ``override`` in an invalid | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -368,3 +368,12 @@ void functional_casts() { | |
|
|
||
| throw S2(5.0f); | ||
| } | ||
| void f(int *); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be good idea to separate with newline. |
||
| void f(double *); | ||
|
|
||
| void test_nullptr_cast() { | ||
| f((int*)nullptr); | ||
| } | ||
| // CHECK-MESSAGES: warning: C-style casts are discouraged | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please verify the line and column numbers and full message like the remaining part of this file. |
||
| // CHECK-FIXES: f(static_cast<int*>(nullptr)); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excessive newline. |
||
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.
Seems like a formatting issue? You can run
git clang-format HEAD~1to fix it :)