[PATCH] D19703: [clang-tidy] Improve misc-redundant-expression and decrease false-positive
Etienne Bergeron via cfe-commits
cfe-commits at lists.llvm.org
Wed May 11 10:33:59 PDT 2016
etienneb added a comment.
+ Removed copy of a vector to a set
+ Fixed some minor coding-style issues
================
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();
----------------
alexfh wrote:
> 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.
Some ideas:
1) We may assume the vector is small and do the lookup.
2) We may assume a sorted vector and do a binary search.
3) The matcher could receive a set instead of a vector and lifting out the copy.
Implemented 3)
http://reviews.llvm.org/D19703
More information about the cfe-commits
mailing list