Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -2695,8 +2695,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(D)) { // Make sure to emit the definition(s) before we emit the thunks. 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/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