[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 02:36:22 PDT 2019
llunak created this revision.
llunak added a reviewer: anton-afanasyev.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill<unsigned long *, int>'.
Repository:
rC Clang
https://reviews.llvm.org/D61822
Files:
lib/CodeGen/CodeGenModule.cpp
lib/Parse/ParseDeclCXX.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/Parse/ParseDeclCXX.cpp
===================================================================
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -3154,8 +3154,13 @@
TagType == DeclSpec::TST_class) && "Invalid TagType!");
llvm::TimeTraceScope TimeScope("ParseClass", [&]() {
- if (auto *TD = dyn_cast_or_null<NamedDecl>(TagDecl))
- return TD->getQualifiedNameAsString();
+ if (auto *TD = dyn_cast_or_null<NamedDecl>(TagDecl)) {
+ std::string Name;
+ llvm::raw_string_ostream OS(Name);
+ TD->getNameForDiagnostic(OS, Actions.getASTContext().getPrintingPolicy(),
+ /*Qualified=*/true);
+ return Name;
+ }
return std::string("<anonymous>");
});
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.199132.patch
Type: text/x-patch
Size: 2765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190511/f7b539ea/attachment.bin>
More information about the cfe-commits
mailing list