[clang] 39d0e41 - [NFC][Clang Improve performance of `DoMarkVarDeclReferenced` (#161648)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 2 04:28:00 PDT 2025
Author: Corentin Jabot
Date: 2025-10-02T13:27:57+02:00
New Revision: 39d0e41a5f3e13b127caea16988d7c69371de6cf
URL: https://github.com/llvm/llvm-project/commit/39d0e41a5f3e13b127caea16988d7c69371de6cf
DIFF: https://github.com/llvm/llvm-project/commit/39d0e41a5f3e13b127caea16988d7c69371de6cf.diff
LOG: [NFC][Clang Improve performance of `DoMarkVarDeclReferenced` (#161648)
Address post commit feedback from #161231
Added:
Modified:
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
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.");
More information about the cfe-commits
mailing list