Skip to content

Commit 6269e6b

Browse files
committed
Swift: move getName to Callable (generated)
Now that getStaticTarget returns a Callable.
1 parent 535daf3 commit 6269e6b

File tree

9 files changed

+59
-38
lines changed

9 files changed

+59
-38
lines changed

swift/ql/.generated.list

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ ql/lib/codeql/swift/elements/type/WeakStorageType.qll 87a28616eea3600fb0156fffcd
363363
ql/lib/codeql/swift/elements/type/WeakStorageTypeConstructor.qll d88b031ef44d6de14b3ddcff2eb47b53dbd11550c37250ff2edb42e5d21ec3e9 26d855c33492cf7a118e439f7baeed0e5425cfaf058b1dcc007eca7ed765c897
364364
ql/lib/codeql/swift/elements.qll 56ea4825f91bb761355f366b0b57ea49cd3df513abf901b370445b0f9264845d 56ea4825f91bb761355f366b0b57ea49cd3df513abf901b370445b0f9264845d
365365
ql/lib/codeql/swift/generated/AstNode.qll 02ca56d82801f942ae6265c6079d92ccafdf6b532f6bcebd98a04029ddf696e4 6216fda240e45bd4302fa0cf0f08f5f945418b144659264cdda84622b0420aa2
366-
ql/lib/codeql/swift/generated/Callable.qll f67df00043a3d7100d1438a5bc9cda18390db89d05047c47650b85ac4eaf3cb5 aab5400c5e31d9175a60c62483609aa7b11bb1dbdb652cba59025d077996c322
366+
ql/lib/codeql/swift/generated/Callable.qll cdadcd29460e9c956b494bde46671f673abd39c91cee4acc8b1cde55afb5e4d4 373904ff78518af88fc1578e830552c157ecdbba2f913aefce7e7b7656111a6e
367367
ql/lib/codeql/swift/generated/Comment.qll f58b49f6e68c21f87c51e2ff84c8a64b09286d733e86f70d67d3a98fe6260bd6 975bbb599a2a7adc35179f6ae06d9cbc56ea8a03b972ef2ee87604834bc6deb1
368368
ql/lib/codeql/swift/generated/DbFile.qll a49b2a2cb2788cb49c861ebcd458b8daead7b15adb19c3a9f4db3bf39a0051fc a49b2a2cb2788cb49c861ebcd458b8daead7b15adb19c3a9f4db3bf39a0051fc
369369
ql/lib/codeql/swift/generated/DbLocation.qll b9baea963d9fa82068986512c0649d1050897654eee3df51dba17cf6b1170873 b9baea963d9fa82068986512c0649d1050897654eee3df51dba17cf6b1170873
@@ -373,15 +373,15 @@ ql/lib/codeql/swift/generated/ErrorElement.qll 4b032abe8ffb71376a29c63e470a52943
373373
ql/lib/codeql/swift/generated/File.qll 61454459f5f1ae378bd4970ad1da4f39f3e696bac8a5eebdd162f131995c5316 3e6805f8858cd55dd0e0d0e5aeab923d6a55292dbf98b0029db1ae0208efe684
374374
ql/lib/codeql/swift/generated/Locatable.qll bdc98b9fb7788f44a4bf7e487ee5bd329473409950a8e9f116d61995615ad849 0b36b4fe45e2aa195e4bb70c50ea95f32f141b8e01e5f23466c6427dd9ab88fb
375375
ql/lib/codeql/swift/generated/Location.qll 851766e474cdfdfa67da42e0031fc42dd60196ff5edd39d82f08d3e32deb84c1 b29b2c37672f5acff15f1d3c5727d902f193e51122327b31bd27ec5f877bca3b
376-
ql/lib/codeql/swift/generated/ParentChild.qll 37af8347ae69f840f37c13b532440a17b871d381130ac86b2c61667026712eea 5989b6d3ef54b5977185cc988e6cab4b796485d8cbe089c8714bcebfbdb11f3a
376+
ql/lib/codeql/swift/generated/ParentChild.qll 0cf944fbfc0b7421b474cf3b4591802292008cb2017f72a42d3a58aacafae226 5989b6d3ef54b5977185cc988e6cab4b796485d8cbe089c8714bcebfbdb11f3a
377377
ql/lib/codeql/swift/generated/PureSynthConstructors.qll 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98
378-
ql/lib/codeql/swift/generated/Raw.qll 6b8e3e3d86254d5689b17a08c41d23cda0d913b5d3b22b18b55aa00363ace6df 3736f05fc2c2eb6a9d9dd0d244061abe72161714cd435233106804472213e2b1
378+
ql/lib/codeql/swift/generated/Raw.qll 6c68d4d8b51f42a19994476cdf8129bf55b6908dbbc643383506d002bbadb6ba f312416ea50d751501a666c9dc070521055caa5ecc72e460b16ac4fe827a4b6a
379379
ql/lib/codeql/swift/generated/Synth.qll 6a9e6edcc43732b6cf947d88b9562a591a54c651aa8e4f94b8b6139ff3f84b63 a1f37bb361fed57104f8277c8f8b1962a0a54b1f80c2d676e71c40a91d3af529
380380
ql/lib/codeql/swift/generated/SynthConstructors.qll 62360813f1419e111732e42e209535a40644997009890d09e4cc70f3918fbf86 62360813f1419e111732e42e209535a40644997009890d09e4cc70f3918fbf86
381381
ql/lib/codeql/swift/generated/UnknownFile.qll 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6
382382
ql/lib/codeql/swift/generated/UnknownLocation.qll e50efefa02a0ec1ff635a00951b5924602fc8cab57e5756e4a039382c69d3882 e50efefa02a0ec1ff635a00951b5924602fc8cab57e5756e4a039382c69d3882
383383
ql/lib/codeql/swift/generated/UnspecifiedElement.qll dbc6ca4018012977b26ca184a88044c55b0661e3998cd14d46295b62a8d69625 184c9a0ce18c2ac881943b0fb400613d1401ed1d5564f90716b6c310ba5afe71
384-
ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll 8255b24dddda83e8a7dee9d69a4cf9883b5a7ae43676d7242b5aab5169f68982 407c7d63681fb03ad6cb4ea3c2b04be7ccb5ddbe655a8aec4219eb3799bc36e8
384+
ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll 76408e1672fe4c18d00e6027171a88a994639034bd90052effb649d472b15478 22d507db18d4d3ed7fc4ecf6e423041249159c048f610ec6fe0866b1b6261c59
385385
ql/lib/codeql/swift/generated/decl/AbstractStorageDecl.qll 882e95e6887741c0cdac4dcafb9efb5182f18484c6d29e84bab0a8f65c9e70a2 0c5c6739484ce3913cfbff68307a5c1cf63639e5ba9043f1f305197fc06b8de9
386386
ql/lib/codeql/swift/generated/decl/AbstractTypeParamDecl.qll 1e268b00d0f2dbbd85aa70ac206c5e4a4612f06ba0091e5253483635f486ccf9 5479e13e99f68f1f347283535f8098964f7fd4a34326ff36ad5711b2de1ab0d0
387387
ql/lib/codeql/swift/generated/decl/AccessorDecl.qll 443cb9888dbdbaee680bf24469ce097a8292806dc53f0b109d492db621fa00aa 0dbe38cbbd3f3cd880c1569d9d42165e7cf0358da0cc7cb63e89890310ad40a0
@@ -650,9 +650,10 @@ ql/lib/codeql/swift/generated/type/WeakStorageType.qll dda4397a49f537ec44117a86d
650650
ql/test/extractor-tests/generated/Comment/MISSING_SOURCE.txt 7e714762ffb48c436102027d560fb5addc1f7dc6dd6936b06e0d3cca031d67fd 7e714762ffb48c436102027d560fb5addc1f7dc6dd6936b06e0d3cca031d67fd
651651
ql/test/extractor-tests/generated/Diagnostics/Diagnostics.ql 6a4a9480cc929381e0337b181e5ac519a7abc6d597ebe24fb6701acf79ced86f 199c5bf8bd38e161d989e0e4db1ea1d3ddcb4d7cf571afd9112ce3ed8d9b8d2a
652652
ql/test/extractor-tests/generated/File/File.ql ab0968ae31b749da2b66462bd04e4dfb30604dba405a84594b575abfc4fa4c35 bcc0ff648b28c5ecd567e196e700272883756bbcc65296bbb880a979e3162628
653-
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl.ql fcf430b5a4631a56f88ff8e05c97f312244d450745d65f9c312f9fd14ccc917f a6423ef93f4aae97dac13f700cbb5c79aeda4762e4524685ad03686468d2925c
653+
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl.ql 5bfde9efcae4418ec82ef8ef39ac42e25888b45d4745221650bb89e79d37cd6f ff78564a33a8f33506cc2cff8eee4b5a55264cfb9964cb1eea0919efec4fa808
654654
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl_getBody.ql 1d42eb1a5b832cfaf1949b61a01a6a11448a6d4369a44f2511bb31d1d7fc10a8 b326a6743121353f8a66410d3d9151ca969939abcbbe5c411872ca290da45123
655655
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl_getGenericTypeParam.ql 8648679e9403477c7f97b6df450a0fa623dc9aff0777021ee33f9cc96eef2611 59c384c35804bf205c3c63e8b956e6bc89d3ded7952911c40e7bf156acb56bf8
656+
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl_getName.ql a8f7b6cbb8ab43ed612cfbb36b48b5d6dd23b1dbe94a99d95fedf80e3c95f89f d70eb32403c4983c58448fe5c9e2d88bc873ab61e0e310c38356a9a144b42978
656657
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl_getParam.ql 7c61c15d75f681c5f5817bdc1e0c1e2594afdc43a5a8889bd385b6cd007d6509 7f6111069c3f289fb3bd21933893757a0adbf8be8f21bf5f8960b6fb26840219
657658
ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl_getSelfParam.ql 0d773ccd4c84a5280f03341cccff8363479b668541d269311215db866a1cfd53 743d584a8d5d85aa11e96ca44151f1239c750bf8a429d60269129696411a0294
658659
ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql 74cf30be2fa4f825f0167bde4489b09683858f762bb335db04fe1cc474dafec6 0911e8a9130622da23f3b2747830c7c8e1659f0c062594bd34f82e335b08448e
@@ -661,9 +662,10 @@ ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql b65b8bb8def2a79501
661662
ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl_getBaseType.ql 5f4fddbb3fb3d003f1485dc4c5a56f7d0d26dfc1d691540085654c4c66e70e69 0b5a5b757ca92e664ef136d26ac682aa5a0e071494d9f09d85f66cd13807e81d
662663
ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl_getGenericTypeParam.ql ca0b73a4f31eea47def7a1de017de36b5fdaec96ae98edb03ff00611bfcac572 f9badd62887a30113484496532b3ff9b67ff5047eb5a311aa2ec2e4d91321e0e
663664
ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl_getMember.ql f73881b14bb4eaf83dacf60b9e46d440227f90566e2dfb8908a55567626ccdda f78a7261f7ccfe01ca55f7279bd5a1a302fc65ba36b13e779426d173c7465b84
664-
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl.ql 27df755f467c5176cf8f26d3b41ebd321834048ce8120a384746c3deeb73cdc3 d4b8363876172e5a152a5126457443dc9fe9ec83c3f0a9bd86eae54473ac8bd9
665+
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl.ql ecc7c4fa21110e6661d4b6b25b1675bd6d8d9129465afff2f66df62513a4b210 207fbb75dabf125f2f79133fc8055e9200390dc7ec0a1abb9cbba5a8522d154f
665666
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl_getBody.ql 3c742b9c8d8d8c23d1bef03f559e1b91f0d3848084ba5819f118c323dd1920a2 340d4e4a6312ffaf4c47bbc753828c1e478d84a2d399c66220288c081c8357ca
666667
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl_getGenericTypeParam.ql b5e64bf02a5991a1549794af0aaab9ae654c88b5d52a3e04b7ac525b3a64af5e 034a7d0bf7500afa952a28d184d1d073e71c3dcec3bc26fcefaed70aef9de3ce
668+
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl_getName.ql d80c7dfdde294264b6763a7129e666efd98111dbf203a9739c24942659d7f832 396e44281e4f4af2188a4f7d246872b7058132b12f508b88dc60d5bdd14e2092
667669
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl_getParam.ql 392bc906a24a432b0dd65a18248cab53874e1ea018b44fdf07d8acb55939c85d cf272febc8355d7171308c0b35f65ae0469106c022093f87ffd25d5951eef4a3
668670
ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl_getSelfParam.ql c8a593149db6785d9bc7017a3fcee305832ab434955b4c36ac2842e214f0acac b70a7c18085961d2c907631d69811071deb391c45c94ef7165bf7ce700dabaf9
669671
ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.ql 5b38d0a84f99a7472a222fe612aa8a04f1ce0f7b804fd95eb75bfb83be5314c0 1a78d482860647c40b85e1119b849268f7d38c41b626d63f6cfa90fa933e9c1a

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ import codeql.swift.elements.decl.ParamDecl
77

88
module Generated {
99
class Callable extends Synth::TCallable, Element {
10+
/**
11+
* Gets the name of this Callable, if it exists.
12+
*/
13+
string getName() { result = Synth::convertCallableToRaw(this).(Raw::Callable).getName() }
14+
15+
/**
16+
* Holds if `getName()` exists.
17+
*/
18+
final predicate hasName() { exists(getName()) }
19+
1020
/**
1121
* Gets the self parameter of this callable, if it exists.
1222
*

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module Raw {
66
}
77

88
class Callable extends @callable, Element {
9+
string getName() { callable_names(this, result) }
10+
911
ParamDecl getSelfParam() { callable_self_params(this, result) }
1012

1113
ParamDecl getParam(int index) { callable_params(this, index, result) }
@@ -154,7 +156,6 @@ module Raw {
154156
}
155157

156158
class AbstractFunctionDecl extends @abstract_function_decl, GenericContext, ValueDecl, Callable {
157-
string getName() { abstract_function_decls(this, result) }
158159
}
159160

160161
class AbstractStorageDecl extends @abstract_storage_decl, ValueDecl {

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,5 @@ import codeql.swift.elements.decl.ValueDecl
77

88
module Generated {
99
class AbstractFunctionDecl extends Synth::TAbstractFunctionDecl, GenericContext, ValueDecl,
10-
Callable {
11-
/**
12-
* Gets the name of this function.
13-
*/
14-
string getName() {
15-
result = Synth::convertAbstractFunctionDeclToRaw(this).(Raw::AbstractFunctionDecl).getName()
16-
}
17-
}
10+
Callable { }
1811
}

swift/ql/lib/swift.dbscheme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ element_is_unknown(
3131
| @abstract_function_decl
3232
;
3333

34+
#keyset[id]
35+
callable_names(
36+
int id: @callable ref,
37+
string name: string ref
38+
);
39+
3440
#keyset[id]
3541
callable_self_params(
3642
int id: @callable ref,
@@ -315,12 +321,6 @@ value_decls( //dir=decl
315321
| @func_decl
316322
;
317323

318-
#keyset[id]
319-
abstract_function_decls( //dir=decl
320-
int id: @abstract_function_decl ref,
321-
string name: string ref
322-
);
323-
324324
@abstract_storage_decl =
325325
@subscript_decl
326326
| @var_decl

swift/ql/test/extractor-tests/generated/decl/AccessorDecl/AccessorDecl.ql

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ import codeql.swift.elements
33
import TestUtils
44

55
from
6-
AccessorDecl x, string hasSelfParam, int getNumberOfParams, string hasBody,
7-
int getNumberOfGenericTypeParams, ModuleDecl getModule, Type getInterfaceType, string getName,
8-
string isGetter, string isSetter, string isWillSet, string isDidSet, string isRead,
9-
string isModify, string isUnsafeAddress, string isUnsafeMutableAddress
6+
AccessorDecl x, string hasName, string hasSelfParam, int getNumberOfParams, string hasBody,
7+
int getNumberOfGenericTypeParams, ModuleDecl getModule, Type getInterfaceType, string isGetter,
8+
string isSetter, string isWillSet, string isDidSet, string isRead, string isModify,
9+
string isUnsafeAddress, string isUnsafeMutableAddress
1010
where
1111
toBeTested(x) and
1212
not x.isUnknown() and
13+
(if x.hasName() then hasName = "yes" else hasName = "no") and
1314
(if x.hasSelfParam() then hasSelfParam = "yes" else hasSelfParam = "no") and
1415
getNumberOfParams = x.getNumberOfParams() and
1516
(if x.hasBody() then hasBody = "yes" else hasBody = "no") and
1617
getNumberOfGenericTypeParams = x.getNumberOfGenericTypeParams() and
1718
getModule = x.getModule() and
1819
getInterfaceType = x.getInterfaceType() and
19-
getName = x.getName() and
2020
(if x.isGetter() then isGetter = "yes" else isGetter = "no") and
2121
(if x.isSetter() then isSetter = "yes" else isSetter = "no") and
2222
(if x.isWillSet() then isWillSet = "yes" else isWillSet = "no") and
@@ -27,8 +27,9 @@ where
2727
if x.isUnsafeMutableAddress()
2828
then isUnsafeMutableAddress = "yes"
2929
else isUnsafeMutableAddress = "no"
30-
select x, "hasSelfParam:", hasSelfParam, "getNumberOfParams:", getNumberOfParams, "hasBody:",
31-
hasBody, "getNumberOfGenericTypeParams:", getNumberOfGenericTypeParams, "getModule:", getModule,
32-
"getInterfaceType:", getInterfaceType, "getName:", getName, "isGetter:", isGetter, "isSetter:",
33-
isSetter, "isWillSet:", isWillSet, "isDidSet:", isDidSet, "isRead:", isRead, "isModify:",
34-
isModify, "isUnsafeAddress:", isUnsafeAddress, "isUnsafeMutableAddress:", isUnsafeMutableAddress
30+
select x, "hasName:", hasName, "hasSelfParam:", hasSelfParam, "getNumberOfParams:",
31+
getNumberOfParams, "hasBody:", hasBody, "getNumberOfGenericTypeParams:",
32+
getNumberOfGenericTypeParams, "getModule:", getModule, "getInterfaceType:", getInterfaceType,
33+
"isGetter:", isGetter, "isSetter:", isSetter, "isWillSet:", isWillSet, "isDidSet:", isDidSet,
34+
"isRead:", isRead, "isModify:", isModify, "isUnsafeAddress:", isUnsafeAddress,
35+
"isUnsafeMutableAddress:", isUnsafeMutableAddress
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// generated by codegen/codegen.py
2+
import codeql.swift.elements
3+
import TestUtils
4+
5+
from AccessorDecl x
6+
where toBeTested(x) and not x.isUnknown()
7+
select x, x.getName()

swift/ql/test/extractor-tests/generated/decl/ConcreteFuncDecl/ConcreteFuncDecl.ql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import codeql.swift.elements
33
import TestUtils
44

55
from
6-
ConcreteFuncDecl x, string hasSelfParam, int getNumberOfParams, string hasBody,
7-
int getNumberOfGenericTypeParams, ModuleDecl getModule, Type getInterfaceType, string getName
6+
ConcreteFuncDecl x, string hasName, string hasSelfParam, int getNumberOfParams, string hasBody,
7+
int getNumberOfGenericTypeParams, ModuleDecl getModule, Type getInterfaceType
88
where
99
toBeTested(x) and
1010
not x.isUnknown() and
11+
(if x.hasName() then hasName = "yes" else hasName = "no") and
1112
(if x.hasSelfParam() then hasSelfParam = "yes" else hasSelfParam = "no") and
1213
getNumberOfParams = x.getNumberOfParams() and
1314
(if x.hasBody() then hasBody = "yes" else hasBody = "no") and
1415
getNumberOfGenericTypeParams = x.getNumberOfGenericTypeParams() and
1516
getModule = x.getModule() and
16-
getInterfaceType = x.getInterfaceType() and
17-
getName = x.getName()
18-
select x, "hasSelfParam:", hasSelfParam, "getNumberOfParams:", getNumberOfParams, "hasBody:",
19-
hasBody, "getNumberOfGenericTypeParams:", getNumberOfGenericTypeParams, "getModule:", getModule,
20-
"getInterfaceType:", getInterfaceType, "getName:", getName
17+
getInterfaceType = x.getInterfaceType()
18+
select x, "hasName:", hasName, "hasSelfParam:", hasSelfParam, "getNumberOfParams:",
19+
getNumberOfParams, "hasBody:", hasBody, "getNumberOfGenericTypeParams:",
20+
getNumberOfGenericTypeParams, "getModule:", getModule, "getInterfaceType:", getInterfaceType
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// generated by codegen/codegen.py
2+
import codeql.swift.elements
3+
import TestUtils
4+
5+
from ConcreteFuncDecl x
6+
where toBeTested(x) and not x.isUnknown()
7+
select x, x.getName()

0 commit comments

Comments
 (0)