[PATCH] D53830: [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'

Alex Strelnikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 21 07:59:10 PST 2018


astrelni marked 5 inline comments as done.
astrelni added a comment.

Sorry for the long delay.

I've reworked the template instantiation stuff a little bit yet again. Going to still come back and comment with results of profiling but I think now this shouldn't be much slower than if the template instantiations were filtered out with the matchers.



================
Comment at: clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp:153
+  // required so we provide only a warning.
+  std::sort(MatchedTemplateLocations.begin(), MatchedTemplateLocations.end());
+  for (SourceLocation Loc : MatchedInstantiationLocations) {
----------------
alexfh wrote:
> MatchedTemplateLocations can be a std::set<SourceLocation> or a std::unordered_set<unsigned> filled with SourceLocation::getRawEncoding(). Same for MatchedInstantiationLocations, I suppose.
Ah thank you, I didn't look hard enough after not seeing a std::hash specialization for SourceLocation. In that case we don't need the onEndOfTranslationUnit or MatchedInstantiationLocations so those are now gone. I added a test case for when a template is used in source before the body since I wasn't 100% sure that the template would be traversed before the instantiation.


https://reviews.llvm.org/D53830





More information about the cfe-commits mailing list