[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-12-02 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6a9487df73e9: Add new clang-tidy check for string_view(nullptr) (authored by CJ-Johnson, committed by ymandel). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-12-01 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 391140. CJ-Johnson added a comment. Delete non-functional test cases (which were previously commented out) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files:

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-12-01 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel accepted this revision. ymandel added a comment. This revision is now accepted and ready to land. To other reviewers: barring any additional comments, I will push this patch tomorrow morning (CJ doesn't have commit rights). Comment at: clang-tools-extra/test/clang-tid

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-12-01 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 391068. CJ-Johnson added a comment. Add missing comment lines Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/Bugpro

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-30 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson added a comment. Pinging this thread with https://reviews.llvm.org/D113148 If we land both this revision and that one, then duplicate warnings won't be a problem. :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://rev

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-30 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 390822. CJ-Johnson added a comment. Rebase on head Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModul

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-30 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 390820. CJ-Johnson added a comment. Address nits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-22 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson added a comment. Thank you all for the feedback! Would it be ok to proceed with removing the `nullptr` checking for `basic_string_view` in `bugprone-string-constructor`, as Alex indicated? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D1

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-22 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 388973. CJ-Johnson added a comment. Rebase on head Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModul

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-22 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 388972. CJ-Johnson marked 6 inline comments as done. CJ-Johnson added a comment. Address reviewer comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files:

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-17 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment. In D113148#3127646 , @ymandel wrote: > This looks really good. An impressive effort! Just a few changes. Also, > please ping Alex to get his opinion on the high level issue. Since this check focuses really well on the issue of c

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D113148#3130779 , @whisperity wrote: > In D113148#3109190 , @CJ-Johnson > wrote: > >> In D113148#3108993 , >> @aaron.ballman wrote: >>

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-15 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment. In D113148#3109190 , @CJ-Johnson wrote: > In D113148#3108993 , @aaron.ballman > wrote: > >> Generally speaking, we prefer to improve the existing checks. I think >> `bugprone-string-

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-12 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 386904. CJ-Johnson marked 3 inline comments as done. CJ-Johnson added a comment. Address review comments from Yitzie Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-12 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson marked 5 inline comments as done. CJ-Johnson added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp:75 + compoundLiteralExpr(has(StringViewConstructingFromNullExpr)), + changeTo(node("null_argument_expr"), cat(""))

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-12 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added a comment. This looks really good. An impressive effort! Just a few changes. Also, please ping Alex to get his opinion on the high level issue. Comment at: clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp:62 + hasSourceExpression(StringV

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385635. CJ-Johnson added a comment. Add missing test cases Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneT

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385575. CJ-Johnson added a comment. Add additional tests for sv.empty() cases to ensure parens are removed where appropriate Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.or

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385532. CJ-Johnson added a comment. Rebase on head Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModul

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385531. CJ-Johnson added a comment. Add missing newline Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidy

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385530. CJ-Johnson added a comment. Add AST matcher support and tests for {{}} case where a null pointer is implicitly created Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-stringview-nullptr.cpp:84 + +(void)(std::string_view({nullptr})) /* a3 */; +// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: constructing basic_string_view from null is undefin

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-08 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385495. CJ-Johnson added a comment. Update test file to use truncated messages Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tid

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-05 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385133. CJ-Johnson added a comment. nits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp cl

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-05 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 385130. CJ-Johnson added a comment. Remove double brackets for list initialization and use default initialization to avoid most vexing parse Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https:/

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384890. CJ-Johnson added a comment. Change static_cast suggested edit to use parens instead of braces Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clan

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384881. CJ-Johnson marked an inline comment as done. CJ-Johnson added a comment. Fix spelling error Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson marked an inline comment as done. CJ-Johnson added a comment. Thanks for the additional info, @aaron.ballman! I had not considered the issues with duplicate warnings. I agree that it would be annoying for users. That being the case, the second option ("remove the string_view nullptr c

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D113148#3109190 , @CJ-Johnson wrote: > As for "we should be careful we're not too onerous when users enable all > `bugprone` checks together.", these fixes are about preventing UB. While I > did put this in the "bugpro

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson added a comment. In D113148#3108993 , @aaron.ballman wrote: > Generally speaking, we prefer to improve the existing checks. I think > `bugprone-string-constructor` would probably be a better place for the > constructor-related functionality.

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384775. CJ-Johnson added a comment. Remove trailing whitespace Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/Bugpr

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: alexfh, njames93, hokein, whisperity. aaron.ballman added a comment. Herald added a subscriber: rnkovacs. In D113148#3108960 , @Sockke wrote: > In D113148#3108705 , @CJ-Johnson > wr

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread gehry via Phabricator via cfe-commits
Sockke added subscribers: whisperity, aaron.ballman. Sockke added a comment. In D113148#3108705 , @CJ-Johnson wrote: > In D113148#3107897 , @Sockke wrote: > >> This seems to be an existing check. Have you compare

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-04 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson added a comment. In D113148#3107897 , @Sockke wrote: > This seems to be an existing check. Have you compared it with > **bugprone-string-constructor**? Thanks for the suggestion! From what I can tell, bugprone-string-constructor check only h

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-03 Thread gehry via Phabricator via cfe-commits
Sockke added a comment. This seems to be an existing check. Have you compared it with **bugprone-string-constructor**? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-03 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384599. CJ-Johnson added a comment. Add missing newline Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidy

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-03 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384598. CJ-Johnson added a comment. Remove mistaken changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/Bugprone

[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)

2021-11-03 Thread CJ Johnson via Phabricator via cfe-commits
CJ-Johnson updated this revision to Diff 384597. CJ-Johnson added a comment. Remove mistaken changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113148/new/ https://reviews.llvm.org/D113148 Files: clang-tools-extra/clang-tidy/bugprone/Bugprone