[clang] Record mainfile name in the Frontend time trace (PR #99866)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 07:39:24 PDT 2024
================
@@ -152,7 +152,13 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
bool HaveLexer = S.getPreprocessor().getCurrentLexer();
if (HaveLexer) {
- llvm::TimeTraceScope TimeScope("Frontend");
+ llvm::TimeTraceScope TimeScope("Frontend", [&]() {
+ llvm::TimeTraceMetadata M;
+ const SourceManager &SM = S.getSourceManager();
+ if (const auto *FE = SM.getFileEntryForID(SM.getMainFileID()))
+ M.File = FE->tryGetRealPathName();
----------------
ilya-biryukov wrote:
Could we still put it under a flag for consistency?
I agree performance concerns are not an issue here, but we are outputting data in a different format now and the name of the main file is actually quite easy to get in most cases because it's passed as a command line argument.
https://github.com/llvm/llvm-project/pull/99866
More information about the cfe-commits
mailing list