[clang] [clang] Output location info in separate fields for -ftime-trace (PR #106277)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 02:57:58 PDT 2024


================
@@ -1255,8 +1256,12 @@ Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition(
   // Add an enclosing time trace scope for a bunch of small scopes with
   // "EvaluateAsConstExpr".
   llvm::TimeTraceScope TimeScope("ParseDeclarationOrFunctionDefinition", [&]() {
-    return Tok.getLocation().printToString(
-        Actions.getASTContext().getSourceManager());
+    llvm::TimeTraceMetadata M;
+    const SourceManager &SM = Actions.getASTContext().getSourceManager();
+    auto Loc = SM.getExpansionLoc(Tok.getLocation());
----------------
usx95 wrote:

I went ahead and did this PR.
I do not have a great home for such a function, went ahead with SourceManager.

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


More information about the cfe-commits mailing list