[PATCH] D143971: [clang-tidy] Flag more buggy string constructor cases

Chris Cotter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 11 16:38:44 PDT 2023


ccotter added a comment.

Thanks, fixed the first false positive example you gave. Let me think about the second example in your most recent post:

  char c = '\n';
  using Size = int;
  Size size = 10U;
  std::string str2(c, size);

This is my newly added case `swapped4`, where one of my original intents was to flag this code as "swapped."  I can see the the ambiguity. Worst case, "confusing string fill constructor arguments" is the fallback that I think is acceptable, and still achieves the goal of at least flagging the code as potentially buggy.


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