[PATCH] D143971: [clang-tidy] Flag code with both string constructor arguments implicitly casted

Chris Cotter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 13 19:57:48 PST 2023


ccotter added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/string-constructor.cpp:40
+
+  std::string swapped('x', 4);
+  // CHECK-MESSAGES: [[@LINE-1]]:15: warning: string constructor arguments are probably swapped; expecting string(count, character) [bugprone-string-constructor]
----------------
`swapped[1,2,5,7]`, `wswapped` were all supported by the original logic - i.e., the ones with a literal char as the first arg.

The other `swapped*` cases are newly supported with my changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143971



More information about the cfe-commits mailing list