[PATCH] D67084: [clang-tidy] Fix bugprone-argument-comment bug: negative literal number is not checked.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 07:04:19 PDT 2019


aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM!



================
Comment at: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp:240
+  Arg = Arg->IgnoreImpCasts();
+  if (isa<UnaryOperator>(Arg))
+      Arg = cast<UnaryOperator>(Arg)->getSubExpr();
----------------
xyb wrote:
> aaron.ballman wrote:
> > The bug claims that this is only for handling negative literals, but this allows any unary operator. Is that intentional? If we're going to allow arbitrary unary operators, why not arbitrary binary operators as well?
> Actually, it handles "UnaryOperator Literal". So it will handle "+12", "-12", "~12". I can restrict it for UO_MINUS only, but is it real necessary? 
It's not that it's necessary, it's that I'm wondering why we think `-12` is special but `0 - 12` is not, but that can be done incrementally later.


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

https://reviews.llvm.org/D67084





More information about the cfe-commits mailing list