https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/161648
Address post commit feedback from #161231 >From 47fe92b868a2d9dc2a1a0760ff728f73e2c18cd2 Mon Sep 17 00:00:00 2001 From: Corentin Jabot <[email protected]> Date: Thu, 2 Oct 2025 12:30:42 +0200 Subject: [PATCH] [NFC][Clang Improve performance of `DoMarkVarDeclReferenced` Address post commit feedback from #161231 --- clang/lib/Sema/SemaExpr.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 06b2529011c74..4d3c7d611f370 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -20107,9 +20107,10 @@ static void DoMarkVarDeclReferenced( bool NeededForConstantEvaluation = isPotentiallyConstantEvaluatedContext(SemaRef) && UsableInConstantExpr; - bool NeedDefinition = OdrUse == OdrUseContext::Used || - NeededForConstantEvaluation || - Var->getType()->isUndeducedType(); + bool NeedDefinition = + OdrUse == OdrUseContext::Used || NeededForConstantEvaluation || + (TSK != clang::TSK_Undeclared && !UsableInConstantExpr && + Var->getType()->isUndeducedType()); assert(!isa<VarTemplatePartialSpecializationDecl>(Var) && "Can't instantiate a partial template specialization."); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
