@@ -85,16 +85,24 @@ struct is_apply_expr
85
85
std::is_same<Ty, DotSyntaxCallExpr>::value ||
86
86
std::is_same<Ty, ConstructorRefCallExpr>::value> {};
87
87
88
+ template <typename Ty>
89
+ struct is_subscript_expr
90
+ : public std::integral_constant<
91
+ bool , std::is_same<Ty, SubscriptExpr>::value ||
92
+ std::is_same<Ty, DynamicSubscriptExpr>::value> {};
93
+
88
94
template <typename Ty>
89
95
struct is_autoclosure_expr
90
96
: public std::integral_constant<bool ,
91
97
std::is_same<Ty, AutoClosureExpr>::value> {
92
98
};
93
99
94
100
template <typename Ty>
95
- struct is_apply_or_autoclosure_expr
96
- : public std::integral_constant<
97
- bool , is_apply_expr<Ty>::value || is_autoclosure_expr<Ty>::value> {};
101
+ struct is_apply_subscript_or_autoclosure_expr
102
+ : public std::integral_constant<bool , is_apply_expr<Ty>::value ||
103
+ is_subscript_expr<Ty>::value ||
104
+ is_autoclosure_expr<Ty>::value> {
105
+ };
98
106
99
107
template <typename Verifier, typename Kind>
100
108
std::pair<bool , Expr *> dispatchVisitPreExprHelper (
@@ -112,6 +120,22 @@ std::pair<bool, Expr *> dispatchVisitPreExprHelper(
112
120
return {false , node};
113
121
}
114
122
123
+ template <typename Verifier, typename Kind>
124
+ std::pair<bool , Expr *> dispatchVisitPreExprHelper (
125
+ Verifier &V,
126
+ typename std::enable_if<
127
+ is_subscript_expr<typename std::remove_pointer<Kind>::type>::value,
128
+ Kind>::type node) {
129
+ if (V.shouldVerify (node)) {
130
+ // Record any inout_to_pointer or array_to_pointer that we see in
131
+ // the proper position.
132
+ V.maybeRecordValidPointerConversion (node, node->getIndex ());
133
+ return {true , node};
134
+ }
135
+ V.cleanup (node);
136
+ return {false , node};
137
+ }
138
+
115
139
template <typename Verifier, typename Kind>
116
140
std::pair<bool , Expr *> dispatchVisitPreExprHelper (
117
141
Verifier &V,
@@ -131,7 +155,7 @@ std::pair<bool, Expr *> dispatchVisitPreExprHelper(
131
155
template <typename Verifier, typename Kind>
132
156
std::pair<bool , Expr *> dispatchVisitPreExprHelper (
133
157
Verifier &V, typename std::enable_if<
134
- !is_apply_or_autoclosure_expr <
158
+ !is_apply_subscript_or_autoclosure_expr <
135
159
typename std::remove_pointer<Kind>::type>::value,
136
160
Kind>::type node) {
137
161
if (V.shouldVerify (node)) {
0 commit comments