make -ftime-trace also print template arguments
authorLubos Lunak <l.lunak@centrum.cz>
Sun, 12 May 2019 10:39:21 +0000 (10:39 +0000)
committerLubos Lunak <l.lunak@centrum.cz>
Sun, 12 May 2019 10:39:21 +0000 (10:39 +0000)
Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill',
now I get 'std::fill<unsigned long *, int>'.

Differential Revision: https://reviews.llvm.org/D61822

llvm-svn: 360539

clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

index 2878f9c6771410caf1166681f7541d951bd1e0c3..3a84bdf94c83183afcf05234685f11f76a373f19 100644 (file)
@@ -2695,8 +2695,13 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD, llvm::GlobalValue *GV) {
     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.
index af56ff06ac49dc5a07b10283462ffd45e3c43d79..edc281cad6ec0c1205fd9d8a57e1438b5052bba5 100644 (file)
@@ -2014,7 +2014,11 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
     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 1c7341d3cf8fafda124c990daab101934e2158e7..6c5847ddfcdbdc761d510ff9a68a6ad3569027a4 100644 (file)
@@ -4156,7 +4156,11 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
   }
 
   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