File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed
Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -93,25 +93,15 @@ struct CollectBoundNodes : MatchFinder::MatchCallback {
9393 StringRef getID () const override { return Unit; }
9494};
9595
96- class QueryProfiler {
97- public:
98- QueryProfiler () = default ;
99- ~QueryProfiler () { printUserFriendlyTable (llvm::errs ()); }
100-
101- void addASTUnitRecord (llvm::StringRef Unit, const llvm::TimeRecord &Record) {
102- Records[Unit] += Record;
103- }
96+ struct QueryProfiler {
97+ llvm::StringMap<llvm::TimeRecord> Records;
10498
105- private:
106- void printUserFriendlyTable (llvm::raw_ostream &OS) {
99+ ~QueryProfiler () {
107100 llvm::TimerGroup TG (" clang-query" , " clang-query matcher profiling" ,
108101 Records);
109- TG.print (OS );
110- OS .flush ();
102+ TG.print (llvm::errs () );
103+ llvm::errs () .flush ();
111104 }
112-
113- private:
114- llvm::StringMap<llvm::TimeRecord> Records;
115105};
116106
117107} // namespace
@@ -150,7 +140,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
150140 Ctx.getParentMapContext ().setTraversalKind (QS.TK );
151141 Finder.matchAST (Ctx);
152142 if (QS.EnableProfile )
153- Profiler->addASTUnitRecord ( OrigSrcName, (*Records)[OrigSrcName]) ;
143+ Profiler->Records [ OrigSrcName] += (*Records)[OrigSrcName];
154144
155145 if (QS.PrintMatcher ) {
156146 SmallVector<StringRef, 4 > Lines;
You can’t perform that action at this time.
0 commit comments