@@ -121,7 +121,27 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
121
121
bool visit (ParameterList *PL) {
122
122
return inherited::visit (PL);
123
123
}
124
-
124
+
125
+ // ===--------------------------------------------------------------------===//
126
+ // Attributes
127
+ // ===--------------------------------------------------------------------===//
128
+ bool visitCustomAttributes (Decl *D) {
129
+ for (auto *customAttr : D->getAttrs ().getAttributes <CustomAttr>()) {
130
+ CustomAttr *mutableCustomAttr = const_cast <CustomAttr *>(customAttr);
131
+ if (doIt (mutableCustomAttr->getTypeLoc ()))
132
+ return true ;
133
+
134
+ if (auto arg = customAttr->getArg ()) {
135
+ if (auto newArg = doIt (arg))
136
+ mutableCustomAttr->setArg (newArg);
137
+ else
138
+ return true ;
139
+ }
140
+ }
141
+
142
+ return false ;
143
+ }
144
+
125
145
// ===--------------------------------------------------------------------===//
126
146
// Decls
127
147
// ===--------------------------------------------------------------------===//
@@ -151,6 +171,16 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
151
171
}
152
172
153
173
bool visitPatternBindingDecl (PatternBindingDecl *PBD) {
174
+ // If there is a single variable, walk it's attributes.
175
+ bool isPropertyDelegateBackingProperty = false ;
176
+ if (auto singleVar = PBD->getSingleVar ()) {
177
+ if (visitCustomAttributes (singleVar))
178
+ return true ;
179
+
180
+ isPropertyDelegateBackingProperty =
181
+ singleVar->getOriginalDelegatedProperty () != nullptr ;
182
+ }
183
+
154
184
unsigned idx = 0U -1 ;
155
185
for (auto entry : PBD->getPatternList ()) {
156
186
++idx;
@@ -159,6 +189,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
159
189
else
160
190
return true ;
161
191
if (entry.getInit () &&
192
+ !isPropertyDelegateBackingProperty &&
162
193
(!entry.isInitializerSubsumed () ||
163
194
Walker.shouldWalkIntoLazyInitializers ())) {
164
195
#ifndef NDEBUG
0 commit comments