https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/218112
>From aff516a3e11121dc071476264a33982a5009d453 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser <[email protected]> Date: Sat, 22 Aug 2026 10:12:52 +0200 Subject: [PATCH 1/2] [Clang] Add TimeTraceScopes to DeduceTemplateArguments --- clang/lib/Sema/SemaTemplateDeduction.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 3c45806c47a6e..e13de97c802b2 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -55,6 +55,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/SaveAndRestore.h" +#include "llvm/Support/TimeProfiler.h" #include <algorithm> #include <cassert> #include <optional> @@ -4489,6 +4490,10 @@ TemplateDeductionResult Sema::DeduceTemplateArguments( if (FunctionTemplate->isInvalidDecl()) return TemplateDeductionResult::Invalid; + llvm::TimeTraceScope TimeScope("DeduceTemplateArguments", [&] { + return FunctionTemplate->getLocation().printToString(SourceMgr); + }); + FunctionDecl *Function = FunctionTemplate->getTemplatedDecl(); unsigned NumParams = Function->getNumParams(); bool HasExplicitObject = false; @@ -4772,6 +4777,10 @@ TemplateDeductionResult Sema::DeduceTemplateArguments( if (FunctionTemplate->isInvalidDecl()) return TemplateDeductionResult::Invalid; + llvm::TimeTraceScope TimeScope("DeduceTemplateArguments", [&] { + return FunctionTemplate->getLocation().printToString(SourceMgr); + }); + FunctionDecl *Function = FunctionTemplate->getTemplatedDecl(); TemplateParameterList *TemplateParams = FunctionTemplate->getTemplateParameters(); >From d5eb098c0348fd7525d9c89865b75a01888c713f Mon Sep 17 00:00:00 2001 From: Nikolas Klauser <[email protected]> Date: Mon, 24 Aug 2026 09:08:42 +0200 Subject: [PATCH 2/2] Fix test --- clang/unittests/Support/TimeProfilerTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/unittests/Support/TimeProfilerTest.cpp b/clang/unittests/Support/TimeProfilerTest.cpp index ae6b16a7377d6..a2d68e4b983f4 100644 --- a/clang/unittests/Support/TimeProfilerTest.cpp +++ b/clang/unittests/Support/TimeProfilerTest.cpp @@ -406,12 +406,16 @@ ExecuteCompiler | | ParseFunctionDefinition (fooA) | | ParseDeclarationOrFunctionDefinition (test.cc:3:5) | | | ParseFunctionDefinition (user) +| | | | DeduceTemplateArguments (./a.h:7:10) | | | | DeferInstantiation (fooA<int>) | PerformPendingInstantiations | | InstantiateFunction (fooA<int>, a.h:7) +| | | DeduceTemplateArguments (./b.h:8:17) | | | InstantiateFunction (fooB<int>, b.h:8) +| | | | DeduceTemplateArguments (./b.h:3:7) | | | | DeferInstantiation (fooC<int>) | | | | BuildCFG +| | | DeduceTemplateArguments (./a.h:4:5 <Spelling=<scratch space>:4:1>) | | | DeferInstantiation (fooMTA<int>) | | | InstantiateFunction (fooC<int>, b.h:3) | | | | BuildCFG _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
