Skip to content

Commit 8eb5792

Browse files
committed
Address review comments
1 parent 1f6d39f commit 8eb5792

File tree

10 files changed

+100
-80
lines changed

10 files changed

+100
-80
lines changed

rust/ql/lib/codeql/rust/AstConsistency.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ query predicate multiplePositions(Element parent, int pos1, int pos2, string acc
7575

7676
private import codeql.rust.elements.internal.PathResolution
7777

78-
/** Holds if `p` may resolve to multiple items. */
79-
query predicate multiplePathResolutions(Path p, Item i) {
78+
/** Holds if `p` may resolve to multiple items including `i`. */
79+
query predicate multiplePathResolutions(Path p, ItemNode i) {
8080
i = resolvePath(p) and
8181
strictcount(resolvePath(p)) > 1
8282
}

rust/ql/lib/codeql/rust/elements/internal/PathImpl.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,11 @@ module Impl {
2727
then result = "...::" + this.getPart().toAbbreviatedString()
2828
else result = this.getPart().toAbbreviatedString()
2929
}
30+
31+
/**
32+
* Gets the text of this path, if it exists.
33+
*/
34+
pragma[nomagic]
35+
string getText() { result = this.getPart().getNameRef().getText() }
3036
}
3137
}

rust/ql/lib/codeql/rust/elements/internal/PathResolution.qll

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class ItemNode extends AstNode {
5757
pragma[inline_late]
5858
predicate isPublic() { exists(this.getVisibility()) }
5959

60-
/** Gets an element that has this item as immediately enlcosing item. */
60+
/** Gets an element that has this item as immediately enclosing item. */
6161
pragma[nomagic]
6262
Element getADescendant() {
6363
getImmediateParent(result) = this
@@ -77,9 +77,8 @@ abstract class ItemNode extends AstNode {
7777
pragma[nomagic]
7878
ModuleLikeNode getImmediateParentModule() { this = result.getAnItemInScope() }
7979

80-
/** Gets a successor named `name` of this item, if any. */
8180
pragma[nomagic]
82-
ItemNode getASuccessor(string name) {
81+
private ItemNode getASuccessorRec(string name) {
8382
sourceFileEdge(this, name, result)
8483
or
8584
this = result.getImmediateParent() and
@@ -91,23 +90,30 @@ abstract class ItemNode extends AstNode {
9190
or
9291
// items made available through `use` are available to nodes that contain the `use`
9392
exists(UseItemNode use |
94-
use = this.getASuccessor(_) and
95-
result = use.getASuccessor(name)
93+
use = this.getASuccessorRec(_) and
94+
result = use.(ItemNode).getASuccessorRec(name)
9695
)
9796
or
9897
// items made available through macro calls are available to nodes that contain the macro call
9998
exists(MacroCallItemNode call |
100-
call = this.getASuccessor(_) and
101-
result = call.getASuccessor(name)
99+
call = this.getASuccessorRec(_) and
100+
result = call.(ItemNode).getASuccessorRec(name)
102101
)
102+
}
103+
104+
/** Gets a successor named `name` of this item, if any. */
105+
pragma[nomagic]
106+
ItemNode getASuccessor(string name) {
107+
result = this.getASuccessorRec(name)
103108
or
104109
name = "super" and
105110
if this instanceof Module
106111
then result = this.getImmediateParentModule()
107112
else result = this.getImmediateParentModule().getImmediateParentModule()
108113
or
109114
name = "self" and
110-
if this instanceof Module then result = this else result = this.getImmediateParentModule()
115+
not this instanceof Module and
116+
result = this.getImmediateParentModule()
111117
or
112118
name = "Self" and
113119
this = result.(ImplOrTraitItemNode).getAnItemInSelfScope()
@@ -224,6 +230,7 @@ private class BlockExprItemNode extends ItemNode instanceof BlockExpr {
224230
override Visibility getVisibility() { none() }
225231
}
226232

233+
/** Holds if `item` has the name `name` and is a top-level item inside `f`. */
227234
private predicate sourceFileEdge(SourceFile f, string name, ItemNode item) {
228235
item = f.getAnItem() and
229236
name = item.getName()
@@ -257,7 +264,7 @@ private predicate modImport(Module m, string fileName, string name, Folder paren
257264
// #[path = "foo.rs"]
258265
// mod bar;
259266
// ```
260-
not m.getAnAttr().getMeta().getPath().getPart().getNameRef().getText() = "path" and
267+
not m.getAnAttr().getMeta().getPath().getText() = "path" and
261268
name = m.getName().getText() and
262269
parent = f.getParentContainer() and
263270
fileName = f.getStem()
@@ -303,7 +310,7 @@ private predicate useTreeDeclares(UseTree tree, string name) {
303310
name != "_"
304311
or
305312
not tree.hasRename() and
306-
name = tree.getPath().getPart().getNameRef().getText()
313+
name = tree.getPath().getText()
307314
)
308315
or
309316
exists(UseTree mid |
@@ -330,31 +337,32 @@ private predicate declares(ItemNode item, string name) {
330337
)
331338
}
332339

340+
/** A path that does not access a local variable. */
333341
private class RelevantPath extends Path {
334342
RelevantPath() { not this = any(VariableAccess va).(PathExpr).getPath() }
335343

336344
pragma[nomagic]
337-
predicate isRoot(string name) {
345+
predicate isUnqualified(string name) {
338346
not exists(this.getQualifier()) and
339347
not this = any(UseTreeList list).getAUseTree().getPath() and
340-
name = this.getPart().getNameRef().getText()
348+
name = this.getText()
341349
}
342350
}
343351

344352
/**
345-
* Holds if the root path `root` references an item named `name`, and `name`
353+
* Holds if the unqualified path `p` references an item named `name`, and `name`
346354
* may be looked up inside enclosing item `encl`.
347355
*/
348356
pragma[nomagic]
349-
private predicate rootPathLookup(RelevantPath root, string name, ItemNode encl) {
357+
private predicate unqualifiedPathLookup(RelevantPath p, string name, ItemNode encl) {
350358
exists(ItemNode encl0 |
351359
// lookup in the immediately enclosing item
352-
root.isRoot(name) and
353-
encl0.getADescendant() = root
360+
p.isUnqualified(name) and
361+
encl0.getADescendant() = p
354362
or
355363
// lookup in an outer scope, but only if the item is not declared in inner scope
356364
exists(ItemNode mid |
357-
rootPathLookup(root, name, mid) and
365+
unqualifiedPathLookup(p, name, mid) and
358366
not declares(mid, name)
359367
|
360368
// nested modules do not have unqualified access to items from outer modules,
@@ -374,7 +382,7 @@ private predicate rootPathLookup(RelevantPath root, string name, ItemNode encl)
374382
cached
375383
ItemNode resolvePath(RelevantPath path) {
376384
exists(ItemNode encl, string name |
377-
rootPathLookup(path, name, encl) and
385+
unqualifiedPathLookup(path, name, encl) and
378386
result = encl.getASuccessor(name)
379387
)
380388
or
@@ -389,7 +397,7 @@ ItemNode resolvePath(RelevantPath path) {
389397
pragma[nomagic]
390398
private ItemNode resolvePathQualifier(RelevantPath path, string name) {
391399
result = resolvePath(path.getQualifier()) and
392-
name = path.getPart().getNameRef().getText()
400+
name = path.getText()
393401
}
394402

395403
private predicate isUseTreeSubPath(UseTree tree, RelevantPath path) {
@@ -405,7 +413,7 @@ pragma[nomagic]
405413
private predicate isUseTreeSubPathUnqualified(UseTree tree, RelevantPath path, string name) {
406414
isUseTreeSubPath(tree, path) and
407415
not exists(path.getQualifier()) and
408-
name = path.getPart().getNameRef().getText()
416+
name = path.getText()
409417
}
410418

411419
pragma[nomagic]
@@ -428,7 +436,7 @@ private ItemNode resolveUseTreeListItemQualifier(
428436
Use use, UseTree tree, RelevantPath path, string name
429437
) {
430438
result = resolveUseTreeListItem(use, tree, path.getQualifier()) and
431-
name = path.getPart().getNameRef().getText()
439+
name = path.getText()
432440
}
433441

434442
pragma[nomagic]

rust/ql/lib/codeql/rust/frameworks/rustcrypto/RustCrypto.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
2525
exists(PathExpr p, string rawAlgorithmName |
2626
this.asExpr().getExpr().(CallExpr).getFunction() = p and
2727
p.getResolvedCrateOrigin().matches("%/RustCrypto%") and
28-
p.getPath().getPart().getNameRef().getText() =
29-
["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and
28+
p.getPath().getText() = ["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and
3029
(
31-
rawAlgorithmName = p.getPath().getQualifier().getPart().getNameRef().getText() or
30+
rawAlgorithmName = p.getPath().getQualifier().(Path).getText() or // todo: remove infix cast when codegenerator has been fixed
3231
rawAlgorithmName =
3332
p.getPath()
3433
.getQualifier()

rust/ql/lib/codeql/rust/security/WeakSensitiveDataHashingExtensions.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ class ModeledHashOperation extends Cryptography::CryptographicOperation::Range {
186186
sinkNode(input, "hasher-input") and
187187
call = input.(Node::FlowSummaryNode).getSinkElement().getCall() and
188188
call = this.asExpr().getExpr() and
189-
algorithmName =
190-
call.getFunction().(PathExpr).getPath().getQualifier().getPart().getNameRef().getText()
189+
algorithmName = call.getFunction().(PathExpr).getPath().getQualifier().(Path).getText() // todo: remove infix cast when codegenerator has been fixed
191190
)
192191
}
193192

rust/ql/src/queries/security/CWE-696/BadCtorInitialization.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CtorAttr extends Attr {
2020
string whichAttr;
2121

2222
CtorAttr() {
23-
whichAttr = this.getMeta().getPath().getPart().getNameRef().getText() and
23+
whichAttr = this.getMeta().getPath().getText() and
2424
whichAttr = ["ctor", "dtor"]
2525
}
2626

rust/ql/test/library-tests/path-resolution/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ mod m8 {
181181
} // I55
182182
} // I46
183183

184+
mod m9 {
185+
pub struct MyStruct {} // I56
186+
187+
#[rustfmt::skip]
188+
pub fn f() -> self::MyStruct { // $ item=I56
189+
println!("main.rs::m9::f");
190+
self::MyStruct {} // $ item=I56
191+
} // I57
192+
}
193+
184194
fn main() {
185195
my::nested::nested1::nested2::f(); // $ item=I4
186196
my::f(); // $ item=I38
@@ -198,4 +208,5 @@ fn main() {
198208
m6::g(); // $ item=I36
199209
m7::f(); // $ item=I45
200210
m8::g(); // $ item=I55
211+
m9::f(); // $ item=I57
201212
}

rust/ql/test/library-tests/path-resolution/path-resolution.expected

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod
1111
| main.rs:109:1:120:1 | mod m6 |
1212
| main.rs:122:1:137:1 | mod m7 |
1313
| main.rs:139:1:182:1 | mod m8 |
14+
| main.rs:184:1:192:1 | mod m9 |
1415
| my2/mod.rs:1:1:1:16 | mod nested2 |
1516
| my2/nested2.rs:1:1:11:1 | mod nested3 |
1617
| my2/nested2.rs:2:5:10:5 | mod nested4 |
@@ -36,7 +37,7 @@ resolvePath
3637
| main.rs:30:17:30:21 | super | main.rs:18:5:36:5 | mod m2 |
3738
| main.rs:30:17:30:24 | ...::f | main.rs:19:9:21:9 | fn f |
3839
| main.rs:33:17:33:17 | f | main.rs:19:9:21:9 | fn f |
39-
| main.rs:40:9:40:13 | super | main.rs:1:1:201:2 | SourceFile |
40+
| main.rs:40:9:40:13 | super | main.rs:1:1:212:2 | SourceFile |
4041
| main.rs:40:9:40:17 | ...::m1 | main.rs:13:1:37:1 | mod m1 |
4142
| main.rs:40:9:40:21 | ...::m2 | main.rs:18:5:36:5 | mod m2 |
4243
| main.rs:40:9:40:24 | ...::g | main.rs:23:9:27:9 | fn g |
@@ -48,7 +49,7 @@ resolvePath
4849
| main.rs:61:17:61:19 | Foo | main.rs:59:9:59:21 | struct Foo |
4950
| main.rs:64:13:64:15 | Foo | main.rs:53:5:53:17 | struct Foo |
5051
| main.rs:66:5:66:5 | f | main.rs:55:5:62:5 | fn f |
51-
| main.rs:68:5:68:8 | self | main.rs:1:1:201:2 | SourceFile |
52+
| main.rs:68:5:68:8 | self | main.rs:1:1:212:2 | SourceFile |
5253
| main.rs:68:5:68:11 | ...::i | main.rs:71:1:83:1 | fn i |
5354
| main.rs:74:13:74:15 | Foo | main.rs:48:1:48:13 | struct Foo |
5455
| main.rs:81:17:81:19 | Foo | main.rs:77:9:79:9 | struct Foo |
@@ -62,7 +63,7 @@ resolvePath
6263
| main.rs:87:57:87:66 | ...::g | my2/nested2.rs:7:9:9:9 | fn g |
6364
| main.rs:87:80:87:86 | nested4 | my2/nested2.rs:2:5:10:5 | mod nested4 |
6465
| main.rs:100:5:100:22 | f_defined_in_macro | main.rs:99:18:99:42 | fn f_defined_in_macro |
65-
| main.rs:117:13:117:17 | super | main.rs:1:1:201:2 | SourceFile |
66+
| main.rs:117:13:117:17 | super | main.rs:1:1:212:2 | SourceFile |
6667
| main.rs:117:13:117:21 | ...::m5 | main.rs:103:1:107:1 | mod m5 |
6768
| main.rs:118:9:118:9 | f | main.rs:104:5:106:5 | fn f |
6869
| main.rs:118:9:118:9 | f | main.rs:110:5:112:5 | fn f |
@@ -88,40 +89,46 @@ resolvePath
8889
| main.rs:173:10:173:17 | MyStruct | main.rs:150:5:150:22 | struct MyStruct |
8990
| main.rs:177:17:177:24 | MyStruct | main.rs:150:5:150:22 | struct MyStruct |
9091
| main.rs:179:17:179:24 | MyStruct | main.rs:150:5:150:22 | struct MyStruct |
91-
| main.rs:185:5:185:6 | my | main.rs:1:1:1:7 | mod my |
92-
| main.rs:185:5:185:14 | ...::nested | my.rs:1:1:1:15 | mod nested |
93-
| main.rs:185:5:185:23 | ...::nested1 | my/nested.rs:1:1:17:1 | mod nested1 |
94-
| main.rs:185:5:185:32 | ...::nested2 | my/nested.rs:2:5:11:5 | mod nested2 |
95-
| main.rs:185:5:185:35 | ...::f | my/nested.rs:3:9:5:9 | fn f |
96-
| main.rs:186:5:186:6 | my | main.rs:1:1:1:7 | mod my |
97-
| main.rs:186:5:186:9 | ...::f | my.rs:5:1:7:1 | fn f |
98-
| main.rs:187:5:187:11 | nested2 | my2/mod.rs:1:1:1:16 | mod nested2 |
99-
| main.rs:187:5:187:20 | ...::nested3 | my2/nested2.rs:1:1:11:1 | mod nested3 |
100-
| main.rs:187:5:187:29 | ...::nested4 | my2/nested2.rs:2:5:10:5 | mod nested4 |
101-
| main.rs:187:5:187:32 | ...::f | my2/nested2.rs:3:9:5:9 | fn f |
102-
| main.rs:188:5:188:5 | f | my2/nested2.rs:3:9:5:9 | fn f |
103-
| main.rs:189:5:189:5 | g | my2/nested2.rs:7:9:9:9 | fn g |
104-
| main.rs:190:5:190:9 | crate | main.rs:1:1:201:2 | SourceFile |
105-
| main.rs:190:5:190:12 | ...::h | main.rs:50:1:69:1 | fn h |
106-
| main.rs:191:5:191:6 | m1 | main.rs:13:1:37:1 | mod m1 |
107-
| main.rs:191:5:191:10 | ...::m2 | main.rs:18:5:36:5 | mod m2 |
108-
| main.rs:191:5:191:13 | ...::g | main.rs:23:9:27:9 | fn g |
109-
| main.rs:192:5:192:6 | m1 | main.rs:13:1:37:1 | mod m1 |
110-
| main.rs:192:5:192:10 | ...::m2 | main.rs:18:5:36:5 | mod m2 |
111-
| main.rs:192:5:192:14 | ...::m3 | main.rs:29:9:35:9 | mod m3 |
112-
| main.rs:192:5:192:17 | ...::h | main.rs:30:27:34:13 | fn h |
113-
| main.rs:193:5:193:6 | m4 | main.rs:39:1:46:1 | mod m4 |
114-
| main.rs:193:5:193:9 | ...::i | main.rs:42:5:45:5 | fn i |
115-
| main.rs:194:5:194:5 | h | main.rs:50:1:69:1 | fn h |
116-
| main.rs:195:5:195:11 | f_alias | my2/nested2.rs:3:9:5:9 | fn f |
117-
| main.rs:196:5:196:11 | g_alias | my2/nested2.rs:7:9:9:9 | fn g |
118-
| main.rs:197:5:197:5 | j | main.rs:97:1:101:1 | fn j |
119-
| main.rs:198:5:198:6 | m6 | main.rs:109:1:120:1 | mod m6 |
120-
| main.rs:198:5:198:9 | ...::g | main.rs:114:5:119:5 | fn g |
121-
| main.rs:199:5:199:6 | m7 | main.rs:122:1:137:1 | mod m7 |
122-
| main.rs:199:5:199:9 | ...::f | main.rs:129:5:136:5 | fn f |
123-
| main.rs:200:5:200:6 | m8 | main.rs:139:1:182:1 | mod m8 |
124-
| main.rs:200:5:200:9 | ...::g | main.rs:169:5:181:5 | fn g |
92+
| main.rs:188:19:188:22 | self | main.rs:184:1:192:1 | mod m9 |
93+
| main.rs:188:19:188:32 | ...::MyStruct | main.rs:185:5:185:26 | struct MyStruct |
94+
| main.rs:190:9:190:12 | self | main.rs:184:1:192:1 | mod m9 |
95+
| main.rs:190:9:190:22 | ...::MyStruct | main.rs:185:5:185:26 | struct MyStruct |
96+
| main.rs:195:5:195:6 | my | main.rs:1:1:1:7 | mod my |
97+
| main.rs:195:5:195:14 | ...::nested | my.rs:1:1:1:15 | mod nested |
98+
| main.rs:195:5:195:23 | ...::nested1 | my/nested.rs:1:1:17:1 | mod nested1 |
99+
| main.rs:195:5:195:32 | ...::nested2 | my/nested.rs:2:5:11:5 | mod nested2 |
100+
| main.rs:195:5:195:35 | ...::f | my/nested.rs:3:9:5:9 | fn f |
101+
| main.rs:196:5:196:6 | my | main.rs:1:1:1:7 | mod my |
102+
| main.rs:196:5:196:9 | ...::f | my.rs:5:1:7:1 | fn f |
103+
| main.rs:197:5:197:11 | nested2 | my2/mod.rs:1:1:1:16 | mod nested2 |
104+
| main.rs:197:5:197:20 | ...::nested3 | my2/nested2.rs:1:1:11:1 | mod nested3 |
105+
| main.rs:197:5:197:29 | ...::nested4 | my2/nested2.rs:2:5:10:5 | mod nested4 |
106+
| main.rs:197:5:197:32 | ...::f | my2/nested2.rs:3:9:5:9 | fn f |
107+
| main.rs:198:5:198:5 | f | my2/nested2.rs:3:9:5:9 | fn f |
108+
| main.rs:199:5:199:5 | g | my2/nested2.rs:7:9:9:9 | fn g |
109+
| main.rs:200:5:200:9 | crate | main.rs:1:1:212:2 | SourceFile |
110+
| main.rs:200:5:200:12 | ...::h | main.rs:50:1:69:1 | fn h |
111+
| main.rs:201:5:201:6 | m1 | main.rs:13:1:37:1 | mod m1 |
112+
| main.rs:201:5:201:10 | ...::m2 | main.rs:18:5:36:5 | mod m2 |
113+
| main.rs:201:5:201:13 | ...::g | main.rs:23:9:27:9 | fn g |
114+
| main.rs:202:5:202:6 | m1 | main.rs:13:1:37:1 | mod m1 |
115+
| main.rs:202:5:202:10 | ...::m2 | main.rs:18:5:36:5 | mod m2 |
116+
| main.rs:202:5:202:14 | ...::m3 | main.rs:29:9:35:9 | mod m3 |
117+
| main.rs:202:5:202:17 | ...::h | main.rs:30:27:34:13 | fn h |
118+
| main.rs:203:5:203:6 | m4 | main.rs:39:1:46:1 | mod m4 |
119+
| main.rs:203:5:203:9 | ...::i | main.rs:42:5:45:5 | fn i |
120+
| main.rs:204:5:204:5 | h | main.rs:50:1:69:1 | fn h |
121+
| main.rs:205:5:205:11 | f_alias | my2/nested2.rs:3:9:5:9 | fn f |
122+
| main.rs:206:5:206:11 | g_alias | my2/nested2.rs:7:9:9:9 | fn g |
123+
| main.rs:207:5:207:5 | j | main.rs:97:1:101:1 | fn j |
124+
| main.rs:208:5:208:6 | m6 | main.rs:109:1:120:1 | mod m6 |
125+
| main.rs:208:5:208:9 | ...::g | main.rs:114:5:119:5 | fn g |
126+
| main.rs:209:5:209:6 | m7 | main.rs:122:1:137:1 | mod m7 |
127+
| main.rs:209:5:209:9 | ...::f | main.rs:129:5:136:5 | fn f |
128+
| main.rs:210:5:210:6 | m8 | main.rs:139:1:182:1 | mod m8 |
129+
| main.rs:210:5:210:9 | ...::g | main.rs:169:5:181:5 | fn g |
130+
| main.rs:211:5:211:6 | m9 | main.rs:184:1:192:1 | mod m9 |
131+
| main.rs:211:5:211:9 | ...::f | main.rs:187:5:191:5 | fn f |
125132
| my2/mod.rs:5:5:5:11 | nested2 | my2/mod.rs:1:1:1:16 | mod nested2 |
126133
| my2/mod.rs:5:5:5:20 | ...::nested3 | my2/nested2.rs:1:1:11:1 | mod nested3 |
127134
| my2/mod.rs:5:5:5:29 | ...::nested4 | my2/nested2.rs:2:5:10:5 | mod nested4 |

rust/ql/test/library-tests/path-resolution/path-resolution.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,9 @@ module ResolveTest implements TestSig {
2323

2424
private predicate item(ItemNode i, string value) {
2525
exists(string filepath, int line, boolean inMacro | itemAt(i, filepath, line, inMacro) |
26-
commmentAt(value, filepath, line) and
27-
inMacro = false
26+
commmentAt(value, filepath, line) and inMacro = false
2827
or
29-
(
30-
not commmentAt(_, filepath, line)
31-
or
32-
inMacro = true
33-
) and
28+
not (commmentAt(_, filepath, line) and inMacro = false) and
3429
value = i.getName()
3530
)
3631
}

rust/ql/test/library-tests/variables/variables.ql

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,9 @@ module VariableAccessTest implements TestSig {
3737

3838
private predicate decl(Variable v, string value) {
3939
exists(string filepath, int line, boolean inMacro | declAt(v, filepath, line, inMacro) |
40-
commmentAt(value, filepath, line) and
41-
inMacro = false
40+
commmentAt(value, filepath, line) and inMacro = false
4241
or
43-
(
44-
not commmentAt(_, filepath, line)
45-
or
46-
inMacro = true
47-
) and
42+
not (commmentAt(_, filepath, line) and inMacro = false) and
4843
value = v.getName()
4944
)
5045
}

0 commit comments

Comments
 (0)