[PATCH] D114823: Filter string_view from the nullptr diagnosis of bugprone-string-constructor to prevent duplicate warnings with bugprone-stringview-nullptr

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 1 05:18:31 PST 2021


ymandel added a comment.

CJ -- please mention "bugprone-stringview-nullptr" explicitly and explain that it will cover those features, etc.  so that the description will be clear on its own. Thanks!



================
Comment at: clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:173-176
+      const auto *StringViewType =
+          Result.Nodes.getNodeAs<CXXRecordDecl>("basic_string_view_decl");
+      // Filter out basic_string_view to avoid conflicts with
+      // bugprone-stringview-nullptr
----------------
Slightly prefer an early return here:
// Filter out basic_string_view to avoid conflicts with
// bugprone-stringview-nullptr
if (Result.Nodes.getNodeAs<CXXRecordDecl>("basic_string_view_decl") != nullptr)
  return;



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114823



More information about the cfe-commits mailing list