[PATCH] D45931: [ASTMatchers] Don't garble the profiling output when multiple TU's are processed

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 22 10:46:06 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: sbenza, alexfh, klimek.

https://reviews.llvm.org/D5911 added support for profiling clang-tidy checks.

It works nice, the tabulated report generated by `clang-tidy -enable-check-profile` is readable.
Unfortunately, it gets complicated with more than just one source file.

You could run `clang-tidy` on each file, then parse the profiles,
combine (sum) based on the `Name` column, and re-display.
Given that the profiles are display friendly, this is messy. (or is there a tool i've missed?)

Or, you could run `clang-tidy` only once, on all the sources at at once.
This obviously does not scale well. But one would think at least
it would sidestep the problem of combining the separate reports.

**One would think**. No, it does not. The profiling info is displayed,
only once at the end of `clang-tidy` run, but the info is garbage.
It only contains some portion of the data. I suspect it only contains the last TU.

This is because `MatchASTVisitor` is kinda smart, it contains it's own local 
`llvm::StringMap<llvm::TimeRecord> TimeByBucket;`, which is used,
and at the end, `MatchASTVisitor::~MatchASTVisitor()` "propagates"
the collected data to the specified profiling info storage.
But it overrides it, not appends/combines...


Repository:
  rC Clang

https://reviews.llvm.org/D45931

Files:
  lib/ASTMatchers/ASTMatchFinder.cpp
  unittests/ASTMatchers/ASTMatchersInternalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45931.143474.patch
Type: text/x-patch
Size: 5455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180422/265c3332/attachment.bin>


More information about the cfe-commits mailing list