[clang] [time-trace] Add a new time trace scope variable named "ParseDeclarationOrFunctionDefinition". (PR #65268)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 12 08:02:42 PDT 2023


================
@@ -1224,6 +1225,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclOrFunctionDefInternal(
 Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition(
     ParsedAttributes &Attrs, ParsedAttributes &DeclSpecAttrs,
     ParsingDeclSpec *DS, AccessSpecifier AS) {
+  // Add an enclosing time trace scope for a bunch of small scopes with
+  // "EvaluateAsConstExpr".
+  llvm::TimeTraceScope TimeScope("ParseDeclarationOrFunctionDefinition");
----------------
AaronBallman wrote:

Ah, I see what's happening there, that makes sense to me to keep a time trace at this level, though I wonder if we should provide the source location of the current token being parsed, similar to how `EvaluateAsConstantExpr` does, so it helps orient the person reading the flame graph.

https://github.com/llvm/llvm-project/pull/65268


More information about the cfe-commits mailing list