[clang] a4ca710 - More cleanup after removing the ability to reference a dependent
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 23:40:34 PDT 2020
Author: Richard Smith
Date: 2020-08-09T23:40:22-07:00
New Revision: a4ca710d9ca9a779a97050149a483f7a5b24dd02
URL: https://github.com/llvm/llvm-project/commit/a4ca710d9ca9a779a97050149a483f7a5b24dd02
DIFF: https://github.com/llvm/llvm-project/commit/a4ca710d9ca9a779a97050149a483f7a5b24dd02.diff
LOG: More cleanup after removing the ability to reference a dependent
VarTemplateSpecializationDecl.
Added:
Modified:
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fe997e7719e7..23b2fbd5cbbf 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17925,8 +17925,6 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
bool NeedDefinition =
OdrUse == OdrUseContext::Used || NeededForConstantEvaluation;
- VarTemplateSpecializationDecl *VarSpec =
- dyn_cast<VarTemplateSpecializationDecl>(Var);
assert(!isa<VarTemplatePartialSpecializationDecl>(Var) &&
"Can't instantiate a partial template specialization.");
@@ -17961,30 +17959,21 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
Var->setTemplateSpecializationKind(TSK, PointOfInstantiation);
}
- bool InstantiationDependent = false;
- bool IsNonDependent =
- VarSpec ? !TemplateSpecializationType::anyDependentTemplateArguments(
- VarSpec->getTemplateArgsInfo(), InstantiationDependent)
- : true;
-
- // Do not instantiate specializations that are still type-dependent.
- if (IsNonDependent) {
- if (UsableInConstantExpr) {
- // Do not defer instantiations of variables that could be used in a
- // constant expression.
- SemaRef.runWithSufficientStackSpace(PointOfInstantiation, [&] {
- SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var);
- });
- } else if (FirstInstantiation ||
- isa<VarTemplateSpecializationDecl>(Var)) {
- // FIXME: For a specialization of a variable template, we don't
- // distinguish between "declaration and type implicitly instantiated"
- // and "implicit instantiation of definition requested", so we have
- // no direct way to avoid enqueueing the pending instantiation
- // multiple times.
- SemaRef.PendingInstantiations
- .push_back(std::make_pair(Var, PointOfInstantiation));
- }
+ if (UsableInConstantExpr) {
+ // Do not defer instantiations of variables that could be used in a
+ // constant expression.
+ SemaRef.runWithSufficientStackSpace(PointOfInstantiation, [&] {
+ SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var);
+ });
+ } else if (FirstInstantiation ||
+ isa<VarTemplateSpecializationDecl>(Var)) {
+ // FIXME: For a specialization of a variable template, we don't
+ // distinguish between "declaration and type implicitly instantiated"
+ // and "implicit instantiation of definition requested", so we have
+ // no direct way to avoid enqueueing the pending instantiation
+ // multiple times.
+ SemaRef.PendingInstantiations
+ .push_back(std::make_pair(Var, PointOfInstantiation));
}
}
}
More information about the cfe-commits
mailing list