[PATCH] D115121: Update bugprone-stringview-nullptr to support return statements and constructors for any T which accepts basic_string_view

CJ Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 13:48:06 PST 2022


CJ-Johnson added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp:263
+  auto HandleConstructorInvocation =
+      makeRule(cxxConstructExpr(hasAnyArgument(ignoringImpCasts(
+                                    BasicStringViewConstructingFromNullExpr)),
----------------
ymandel wrote:
> precede with `argumentCountIs(1)`? Also, please comment on choice of `hasAnyArgument` (copying what you wrote in the patch description is fine).
Added the code comments, but not the argument count matcher. This case intentionally matches any number of arguments since some types make take 2+ parameters where one of them is string_view.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115121/new/

https://reviews.llvm.org/D115121



More information about the cfe-commits mailing list