Skip to content

Commit 5b3cac2

Browse files
authored
Merge pull request #6568 from rudkx/const-exprs
Make ConstraintSystem's hasType/getType take const Exprs.
2 parents 1b5adb7 + 7396a36 commit 5b3cac2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ class ConstraintSystem {
906906
/// nodes themselves. This allows us to typecheck an expression and
907907
/// run through various diagnostics passes without actually mutating
908908
/// the types on the expression nodes.
909-
llvm::DenseMap<Expr *, TypeBase *> ExprTypes;
909+
llvm::DenseMap<const Expr *, TypeBase *> ExprTypes;
910910

911911
/// There can only be a single contextual type on the root of the expression
912912
/// being checked. If specified, this holds its type along with the base
@@ -1388,16 +1388,16 @@ class ConstraintSystem {
13881388
}
13891389

13901390
/// Check to see if we have a type for an expression.
1391-
bool hasType(Expr *E) {
1391+
bool hasType(const Expr *E) const {
13921392
return ExprTypes.find(E) != ExprTypes.end();
13931393
}
13941394

13951395
/// Get the type for an expression.
1396-
Type getType(Expr *E) {
1396+
Type getType(const Expr *E) const {
13971397
assert(hasType(E) && "Expected type to have been set!");
1398-
assert(ExprTypes[E]->isEqual(E->getType()) &&
1398+
assert(ExprTypes.find(E)->second->isEqual(E->getType()) &&
13991399
"Expected type in map to be the same type in expression!");
1400-
return ExprTypes[E];
1400+
return ExprTypes.find(E)->second;
14011401
}
14021402

14031403
/// Cache the type of the expression argument and return that same

0 commit comments

Comments
 (0)