[clang] [clang] Properly set file and line info for -ftime-trace (PR #106277)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 02:29:48 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());
----------------
ilya-biryukov wrote:
Could we extract the function that fills `SourceLocation` into `TimeTraceMetadata`?
This can be done in a follow up, but we are starting to have too many places now that do the same thing and should all be changed together (e.g. if we'd want to spell filename in some other way or if we'd want to use something other than expansionLocation in the future, or we'd want to add a column, etc)
https://github.com/llvm/llvm-project/pull/106277
More information about the cfe-commits
mailing list