[PATCH] D19703: [clang-tidy] Improve misc-redundant-expression and decrease false-positive

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 09:23:57 PDT 2016


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG.


================
Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:140
@@ +139,3 @@
+  const LangOptions &LO = Finder->getASTContext().getLangOpts();
+  std::set<std::string> Names(NameRefs.begin(), NameRefs.end());
+  SourceLocation Loc = Node.getExprLoc();
----------------
Is there a way to not create a set on each call to the matcher? There also might be a more suitable container in llvm/ADT.

================
Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:189
@@ +188,3 @@
+          anyOf(
+              hasOverloadedOperatorName("-"), hasOverloadedOperatorName("/"),
+              hasOverloadedOperatorName("%"), hasOverloadedOperatorName("|"),
----------------
We should add a `hasAnyOverloadedOperatorName` matcher at some point.


http://reviews.llvm.org/D19703





More information about the cfe-commits mailing list