[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 06:01:46 PDT 2024


================
@@ -18046,6 +18048,19 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
                 std::make_pair(Func, PointOfInstantiation));
             // Notify the consumer that a function was implicitly instantiated.
             Consumer.HandleCXXImplicitFunctionInstantiation(Func);
+
+            llvm::timeTraceProfilerInsert("DeferInstantiation", [&]() {
+              llvm::TimeTraceMetadata M;
+              llvm::raw_string_ostream OS(M.Detail);
+              Func->getNameForDiagnostic(OS, getPrintingPolicy(),
+                                         /*Qualified=*/true);
+              if (llvm::isTimeTraceVerbose()) {
+                auto Loc = SourceMgr.getExpansionLoc(Func->getLocation());
+                M.File = SourceMgr.getFilename(Loc);
+                M.Line = SourceMgr.getExpansionLineNumber(Loc);
----------------
usx95 wrote:

I do not think we need location information for deferred instantiations. The fully qualified name should be good enough to find the matching actual TemplateInstantiation.

https://github.com/llvm/llvm-project/pull/103039


More information about the cfe-commits mailing list