[PATCH] D61822: make -ftime-trace also print template arguments

Luboš Luňák via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 11 04:01:43 PDT 2019


llunak updated this revision to Diff 199133.
llunak added a comment.

Removed the parse case, getNameForDiagnostic() apparently prints nothing there.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61822/new/

https://reviews.llvm.org/D61822

Files:
  lib/CodeGen/CodeGenModule.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp


Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4156,7 +4156,11 @@
   }
 
   llvm::TimeTraceScope TimeScope("InstantiateFunction", [&]() {
-    return Function->getQualifiedNameAsString();
+    std::string Name;
+    llvm::raw_string_ostream OS(Name);
+    Function->getNameForDiagnostic(OS, getPrintingPolicy(),
+                                   /*Qualified=*/true);
+    return Name;
   });
 
   // If we're performing recursive template instantiation, create our own
Index: lib/Sema/SemaTemplateInstantiate.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiate.cpp
+++ lib/Sema/SemaTemplateInstantiate.cpp
@@ -2014,7 +2014,11 @@
     return true;
 
   llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() {
-    return Instantiation->getQualifiedNameAsString();
+    std::string Name;
+    llvm::raw_string_ostream OS(Name);
+    Instantiation->getNameForDiagnostic(OS, getPrintingPolicy(),
+                                        /*Qualified=*/true);
+    return Name;
   });
 
   Pattern = PatternDef;
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2489,8 +2489,13 @@
     if (!shouldEmitFunction(GD))
       return;
 
-    llvm::TimeTraceScope TimeScope(
-        "CodeGen Function", [&]() { return FD->getQualifiedNameAsString(); });
+    llvm::TimeTraceScope TimeScope("CodeGen Function", [&]() {
+      std::string Name;
+      llvm::raw_string_ostream OS(Name);
+      FD->getNameForDiagnostic(OS, getContext().getPrintingPolicy(),
+                               /*Qualified=*/true);
+      return Name;
+    });
 
     if (const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
       // Make sure to emit the definition(s) before we emit the thunks.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61822.199133.patch
Type: text/x-patch
Size: 2013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190511/04b7cfee/attachment.bin>


More information about the cfe-commits mailing list