Skip to content

Commit b08b123

Browse files
committed
Swift: Support new accessors
1 parent 26f59a8 commit b08b123

File tree

12 files changed

+188
-48
lines changed

12 files changed

+188
-48
lines changed

swift/extractor/translators/DeclTranslator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ codeql::Accessor DeclTranslator::translateAccessorDecl(const swift::AccessorDecl
198198
entry.is_unsafe_mutable_address = true;
199199
break;
200200
case swift::AccessorKind::DistributedGet:
201-
// TODO: Swift 6.2
201+
entry.is_distributed_get = true;
202202
break;
203203
case swift::AccessorKind::Read2:
204-
// TODO: Swift 6.2
204+
entry.is_read2 = true;
205205
break;
206206
case swift::AccessorKind::Modify2:
207-
// TODO: Swift 6.2
207+
entry.is_modify2 = true;
208208
break;
209209
case swift::AccessorKind::Init:
210-
// TODO: Swift 6.2
210+
entry.is_init = true;
211211
break;
212212
}
213213
fillFunction(decl, entry);

swift/ql/.generated.list

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift/ql/lib/codeql/swift/elements/decl/internal/AccessorImpl.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ module Impl {
1818
decl.isUnsafeAddress() and kind = "unsafeAddress"
1919
or
2020
decl.isUnsafeMutableAddress() and kind = "unsafeMutableAddress"
21+
or
22+
decl.isDistributedGet() and kind = "distributed get"
23+
or
24+
decl.isRead2() and kind = "read"
25+
or
26+
decl.isModify2() and kind = "modify"
27+
or
28+
decl.isInit() and kind = "init"
2129
}
2230

2331
class Accessor extends Generated::Accessor {

swift/ql/lib/codeql/swift/generated/Raw.qll

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift/ql/lib/codeql/swift/generated/decl/Accessor.qll

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift/ql/lib/swift.dbscheme

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift/ql/test/extractor-tests/declarations/declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct HasPropertyAndObserver {
8686
}
8787
}
8888

89-
// A field can be marked as read-only by dirctly implementing
89+
// A field can be marked as read-only by directly implementing
9090
// the getter between the braces.
9191
var readOnlyField1: Int {
9292
return 0

0 commit comments

Comments
 (0)