Skip to content

Commit c128f6f

Browse files
committed
[Constraint system] Generalize ParamDecl type tracking to VarDecl.
1 parent eb61ae7 commit c128f6f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ struct Score {
578578
/// An AST node that can gain type information while solving.
579579
using TypedNode =
580580
llvm::PointerUnion3<const Expr *, const TypeLoc *,
581-
const ParamDecl *>;
581+
const VarDecl *>;
582582

583583
/// Display a score.
584584
llvm::raw_ostream &operator<<(llvm::raw_ostream &out, const Score &score);
@@ -1065,7 +1065,7 @@ class ConstraintSystem {
10651065
/// the types on the expression nodes.
10661066
llvm::DenseMap<const Expr *, TypeBase *> ExprTypes;
10671067
llvm::DenseMap<const TypeLoc *, TypeBase *> TypeLocTypes;
1068-
llvm::DenseMap<const ParamDecl *, TypeBase *> ParamTypes;
1068+
llvm::DenseMap<const VarDecl *, TypeBase *> VarTypes;
10691069
llvm::DenseMap<std::pair<const KeyPathExpr *, unsigned>, TypeBase *>
10701070
KeyPathComponentTypes;
10711071

@@ -1833,8 +1833,8 @@ class ConstraintSystem {
18331833
} else if (auto typeLoc = node.dyn_cast<const TypeLoc *>()) {
18341834
TypeLocTypes[typeLoc] = type.getPointer();
18351835
} else {
1836-
auto param = node.get<const ParamDecl *>();
1837-
ParamTypes[param] = type.getPointer();
1836+
auto var = node.get<const VarDecl *>();
1837+
VarTypes[var] = type.getPointer();
18381838
}
18391839

18401840
// Record the fact that we ascribed a type to this node.
@@ -1858,8 +1858,8 @@ class ConstraintSystem {
18581858
} else if (auto typeLoc = node.dyn_cast<const TypeLoc *>()) {
18591859
TypeLocTypes.erase(typeLoc);
18601860
} else {
1861-
auto param = node.get<const ParamDecl *>();
1862-
ParamTypes.erase(param);
1861+
auto var = node.get<const VarDecl *>();
1862+
VarTypes.erase(var);
18631863
}
18641864
}
18651865

@@ -1887,8 +1887,8 @@ class ConstraintSystem {
18871887
} else if (auto typeLoc = node.dyn_cast<const TypeLoc *>()) {
18881888
return TypeLocTypes.find(typeLoc) != TypeLocTypes.end();
18891889
} else {
1890-
auto param = node.get<const ParamDecl *>();
1891-
return ParamTypes.find(param) != ParamTypes.end();
1890+
auto var = node.get<const VarDecl *>();
1891+
return VarTypes.find(var) != VarTypes.end();
18921892
}
18931893
}
18941894

@@ -1913,9 +1913,9 @@ class ConstraintSystem {
19131913
return TypeLocTypes.find(&L)->second;
19141914
}
19151915

1916-
Type getType(const ParamDecl *P) const {
1917-
assert(hasType(P) && "Expected type to have been set!");
1918-
return ParamTypes.find(P)->second;
1916+
Type getType(const VarDecl *VD) const {
1917+
assert(hasType(VD) && "Expected type to have been set!");
1918+
return VarTypes.find(VD)->second;
19191919
}
19201920

19211921
Type getType(const KeyPathExpr *KP, unsigned I) const {

0 commit comments

Comments
 (0)