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

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 00:47:57 PDT 2018


avt77 added inline comments.


================
Comment at: lib/Sema/SemaLambda.cpp:1447
+    getFrontendFunctionTimeCtx<const FunctionDecl *>()->startFrontendTimer(
+        {LSI.CallOperator, 0.0});
+  }
----------------
efriedma wrote:
> This seems sort of late?  You're starting the timer after the body has already been parsed.
Yes and no but if we decided to extend usage of RAII objects - it deos not matter. I'll change it.


================
Comment at: lib/Sema/TreeTransform.h:11011
+    getFrontendFunctionTimeCtx<const FunctionDecl *>()->startFrontendTimer(
+        {NewCallOperator, 0.0});
+  }
----------------
efriedma wrote:
> 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.)
It seems you're right: usage of RAII objects is safely. OK, I'll change it.


https://reviews.llvm.org/D47196





More information about the llvm-commits mailing list