[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
Fri Oct 6 11:13:08 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:

Also, I wonder if we want more or less granularity here. This will fire for function declarations and function definitions, so we could add it to `Parser::ParseFunctionDefinition()` instead to only time function definition parsing, or we could split it up so that we time parsing function signatures separately from parsing the function body so we can more easily see how much time is spent in which activity.

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


More information about the cfe-commits mailing list