@@ -93,6 +93,10 @@ class SwiftDispatcher {
9393 return fetchLabelFromUnion<AstNodeTag>(node);
9494 }
9595
96+ TrapLabel<IfConfigClauseTag> fetchLabel (const swift::IfConfigClause& clause) {
97+ return fetchLabel (&clause);
98+ }
99+
96100 TrapLabel<ConditionElementTag> fetchLabel (const swift::StmtConditionElement& element) {
97101 return fetchLabel (&element);
98102 }
@@ -140,6 +144,15 @@ class SwiftDispatcher {
140144 attachLocation (locatable->getStartLoc (), locatable->getEndLoc (), locatableLabel);
141145 }
142146
147+ void attachLocation (const swift::IfConfigClause* clause, TrapLabel<LocatableTag> locatableLabel) {
148+ attachLocation (clause->Loc , clause->Loc , locatableLabel);
149+ }
150+
151+ // Emits a Location TRAP entry and attaches it to a `Locatable` trap label for a given `SourceLoc`
152+ void attachLocation (swift::SourceLoc loc, TrapLabel<LocatableTag> locatableLabel) {
153+ attachLocation (loc, loc, locatableLabel);
154+ }
155+
143156 // Emits a Location TRAP entry for a list of swift entities and attaches it to a `Locatable` trap
144157 // label
145158 template <typename Locatable>
@@ -215,7 +228,8 @@ class SwiftDispatcher {
215228 swift::Expr,
216229 swift::Pattern,
217230 swift::TypeRepr,
218- swift::TypeBase>;
231+ swift::TypeBase,
232+ swift::IfConfigClause>;
219233
220234 void attachLocation (swift::SourceLoc start,
221235 swift::SourceLoc end,
@@ -269,9 +283,11 @@ class SwiftDispatcher {
269283 return realPath.str ().str ();
270284 }
271285
272- // TODO: The following methods are supposed to redirect TRAP emission to correpsonding visitors,
273- // which are to be introduced in follow-up PRs
286+ // TODO: for const correctness these should consistently be `const` (and maybe const references
287+ // as we don't expect `nullptr` here. However `swift::ASTVisitor` and `swift::TypeVisitor` do not
288+ // accept const pointers
274289 virtual void visit (swift::Decl* decl) = 0;
290+ virtual void visit (const swift::IfConfigClause* clause) = 0;
275291 virtual void visit (swift::Stmt* stmt) = 0;
276292 virtual void visit (const swift::StmtCondition* cond) = 0;
277293 virtual void visit (const swift::StmtConditionElement* cond) = 0;
0 commit comments