From 589b82d1efbd3c1a97b41692370e32ddd3a65efc Mon Sep 17 00:00:00 2001 From: Lubos Lunak Date: Sun, 12 May 2019 10:39:21 +0000 Subject: [PATCH] make -ftime-trace also print template arguments Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill'. Differential Revision: https://reviews.llvm.org/D61822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360539 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 9 +++++++-- lib/Sema/SemaTemplateInstantiate.cpp | 6 +++++- lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 2878f9c677..3a84bdf94c 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -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(D)) { // Make sure to emit the definition(s) before we emit the thunks. diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index af56ff06ac..edc281cad6 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -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; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 1c7341d3cf..6c5847ddfc 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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 -- 2.50.1