Skip to content

Commit 97fdc23

Browse files
committed
[NFC] [Modules] Adding profiling points to template lookups in serializer
1 parent 8e4fb4b commit 97fdc23

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang/lib/Serialization/ASTReader.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8381,6 +8381,15 @@ bool ASTReader::LoadExternalSpecializationsImpl(
83818381
if (It == SpecLookups.end())
83828382
return false;
83838383

8384+
llvm::TimeTraceScope TimeScope("Load External Specializations for ", [&] {
8385+
std::string Name;
8386+
llvm::raw_string_ostream OS(Name);
8387+
auto *ND = cast<NamedDecl>(D);
8388+
ND->getNameForDiagnostic(OS, ND->getASTContext().getPrintingPolicy(),
8389+
/*Qualified=*/true);
8390+
return Name;
8391+
});
8392+
83848393
Deserializing LookupResults(this);
83858394
auto HashValue = StableHashForTemplateArguments(TemplateArgs);
83868395

clang/lib/Serialization/TemplateArgumentHasher.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "clang/AST/TypeVisitor.h"
1616
#include "clang/Basic/IdentifierTable.h"
1717
#include "llvm/ADT/FoldingSet.h"
18+
#include "llvm/Support/TimeProfiler.h"
1819

1920
using namespace clang;
2021

@@ -405,6 +406,7 @@ void TemplateArgumentHasher::AddType(const Type *T) {
405406

406407
unsigned clang::serialization::StableHashForTemplateArguments(
407408
llvm::ArrayRef<TemplateArgument> Args) {
409+
llvm::TimeTraceScope TimeScope("Stable Hash for Template Arguments");
408410
TemplateArgumentHasher Hasher;
409411
Hasher.AddInteger(Args.size());
410412
for (TemplateArgument Arg : Args)

0 commit comments

Comments
 (0)