[PATCH] D13079: [clang-tidy] Code factorization and cleanup in IdentifierNamingCheck
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 24 09:44:41 PDT 2015
alexfh added a comment.
Please add more context to the diffs.
================
Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:508
@@ +507,3 @@
+ auto &Failure = Failures[Decl];
+ for (const auto &R : Failure.Usages) {
+ if (R == Range)
----------------
berenm wrote:
> Hopefully the number of ranges in Usages will stay low. If not, `Usages` should be an hash table instead, but it looks like SourceRange isn't hashable as is.
If the ranges represent unique variable usages, then there definitely will be corner cases that will make this code run sloooowly. I'd prefer this to be a llvm::SmallSet<>, llvm::DenseSet<>, std::unordered_set, std::set, std::multimap<SourceLocation, SourceLocation> or anything else providing a sub-linear lookup time. I'd probably go with llvm::SmallSet<> with a custom comparer for SourceRange.
http://reviews.llvm.org/D13079
More information about the cfe-commits
mailing list