Skip to content

Commit 43e5aba

Browse files
committed
Swift: do not extract unresolved things from IfConfigDecl
This avoids extracting things that are unresolved within an `IfConfigDecl` instance: * all conditions * all inactive code blocks This is meant to test out the hypothesis that this should solve some extractor issues. If going through with it we should definitely change the schema model for this. Also, tests have not been updated and are expected to fail.
1 parent a8a7909 commit 43e5aba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

swift/extractor/visitors/DeclVisitor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,16 @@ void DeclVisitor::fillAbstractStorageDecl(const swift::AbstractStorageDecl& decl
380380

381381
codeql::IfConfigDecl DeclVisitor::translateIfConfigDecl(const swift::IfConfigDecl& decl) {
382382
auto entry = createEntry(decl);
383-
entry.clauses = dispatcher_.fetchRepeatedLabels(decl.getClauses());
383+
// entry.clauses = dispatcher_.fetchRepeatedLabels(decl.getClauses());
384+
if (auto activeClause = decl.getActiveClause()) {
385+
entry.clauses.push_back(dispatcher_.fetchLabel(activeClause));
386+
}
384387
return entry;
385388
}
386389

387390
codeql::IfConfigClause DeclVisitor::translateIfConfigClause(const swift::IfConfigClause& clause) {
388391
auto entry = dispatcher_.createEntry(clause);
389-
entry.condition = dispatcher_.fetchOptionalLabel(clause.Cond);
392+
// entry.condition = dispatcher_.fetchOptionalLabel(clause.Cond);
390393
entry.elements = dispatcher_.fetchRepeatedLabels(clause.Elements);
391394
entry.is_active = clause.isActive;
392395
return entry;

0 commit comments

Comments
 (0)