[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 14:22:22 PDT 2023


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:4003-4004
+  // that are not referenced or used later. e.g.: if (int var = init());
+  ConditionVar->setReferenced(false);
+  ConditionVar->setIsUsed(false);
+
----------------
tbaeder wrote:
> shafik wrote:
> > 
> That seem a bit over the top given that it's the only boolean parameter.
Yeah, in this case it is blindingly obvious but I do see many cases in the code where folks use `bugprone-argument-comment` for single bool parameters and I just use it everywhere for consistency sake.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152495



More information about the cfe-commits mailing list