[clang-tidy] Profile is a per-AST (per-TU) data.
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 8 May 2018 13:14:21 +0000 (13:14 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 8 May 2018 13:14:21 +0000 (13:14 +0000)
commit12152511518ef370a24923539a3ac792e387789f
tree7d173ae59d5167e8b88151fb975625ceeccd7b9d
parent8f266dbbdcddb0fb9df96cb02b40550cdfdd5dd6
[clang-tidy] Profile is a per-AST (per-TU) data.

Summary:
As discussed in D45931, currently, profiling output of clang-tidy is somewhat not great.
It outputs one profile at the end of the execution, and that profile contains the data
from the last TU that was processed. So if the tool run on multiple TU's, the data is
not accumulated, it is simply discarded.

It would be nice to improve this.

This differential is the first step - make this profiling info per-TU,
and output it after the tool has finished processing each TU.
In particular, when `ClangTidyASTConsumer` destructor runs.

Next step will be to add a CSV (JSON?) printer to store said profiles under user-specified directory prefix.

Reviewers: alexfh, sbenza

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, mgorny, xazax.hun, mgrang, klimek, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D46504

llvm-svn: 331763
clang-tools-extra/clang-tidy/CMakeLists.txt
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang-tools-extra/clang-tidy/ClangTidy.h
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/ClangTidyProfiling.h [new file with mode: 0644]
clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-two-tu.cpp [new file with mode: 0644]