[PATCH] D47196: [Time-report ](2): Recursive timers in Clang

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 17:28:28 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Sema/SemaLambda.cpp:1447
+    getFrontendFunctionTimeCtx<const FunctionDecl *>()->startFrontendTimer(
+        {LSI.CallOperator, 0.0});
+  }
----------------
This seems sort of late?  You're starting the timer after the body has already been parsed.


================
Comment at: lib/Sema/TreeTransform.h:11011
+    getFrontendFunctionTimeCtx<const FunctionDecl *>()->startFrontendTimer(
+        {NewCallOperator, 0.0});
+  }
----------------
What happens if we never hit ActOnFinishFunctionBody()?  TransformLambdaExpr has an early return if the body doesn't typecheck.

More generally, given that we have early returns all over the place in Sema, I would be more comfortable using the RAII helper, rather than explicitly calling start/stop, even if that means you have to insert FrontendTimeRAII variables in half a dozen different places in the parser.  (Note I'm specifically talking about the parser here; the explicit stopFrontendTimer in ~CodeGenFunction seems fine.)


https://reviews.llvm.org/D47196





More information about the llvm-commits mailing list