[PATCH] Add support for profiling the matchers used.

Alexander Kornienko alexfh at google.com
Wed Oct 22 10:21:42 PDT 2014


Awesome! A couple of comments inline.

================
Comment at: include/clang/ASTMatchers/ASTMatchFinder.h:123
@@ +122,3 @@
+      /// \brief Output for the report. If null, it prints to llvm::errs()
+      std::unique_ptr<llvm::raw_ostream> OS;
+    };
----------------
I'd prefer a more structured interface, e.g. a map from string to some struct containing collected timings + a method to convert this map to string or print it to a stream. Not sure if this fits well with LLVM timing facilities you use, though.

================
Comment at: lib/ASTMatchers/ASTMatchFinder.cpp:315
@@ -300,1 +314,3 @@
+      llvm::TimeRegion Timer(
+          EnableCheckProfiling ? getTimerForBucket(MC->getID()) : nullptr);
       MC->onStartOfTranslationUnit();
----------------
You can check EnableCheckProfiling inside getTimerForBucket to reduce code repetition.

http://reviews.llvm.org/D5911






More information about the cfe-commits mailing list