[clang] Record mainfile name in the Frontend time trace (PR #99866)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 07:45:32 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();
----------------
usx95 wrote:

Done.

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


More information about the cfe-commits mailing list