Skip to content

Commit 66febb2

Browse files
committed
JS: Add some overlay[caller] and a pragma[nomagic] annotations
1 parent 8892097 commit 66febb2

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ module AccessPath {
356356
* Gets a variable that is relevant for the computations in the `GetLaterAccess` module.
357357
* This predicate restricts as much as it can, but without depending on `getAVariableRef`.
358358
*/
359+
overlay[caller]
359360
pragma[inline]
360361
private SsaVariable getARelevantVariableSimple() {
361362
// The variable might be used where `getLaterBaseAccess()` is called.
@@ -407,6 +408,7 @@ module AccessPath {
407408
* }
408409
* ```
409410
*/
411+
overlay[caller]
410412
pragma[inline]
411413
DataFlow::Node getAReferenceTo(Root root, string path) {
412414
path = fromReference(result, root) and
@@ -430,6 +432,7 @@ module AccessPath {
430432
* })(NS = NS || {});
431433
* ```
432434
*/
435+
overlay[caller]
433436
pragma[inline]
434437
DataFlow::Node getAReferenceTo(string path) {
435438
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode())
@@ -451,6 +454,7 @@ module AccessPath {
451454
* }
452455
* ```
453456
*/
457+
overlay[caller]
454458
pragma[inline]
455459
DataFlow::Node getAnAssignmentTo(Root root, string path) {
456460
path = fromRhs(result, root) and
@@ -472,6 +476,7 @@ module AccessPath {
472476
* })(foo = foo || {});
473477
* ```
474478
*/
479+
overlay[caller]
475480
pragma[inline]
476481
DataFlow::Node getAnAssignmentTo(string path) {
477482
path = fromRhs(result, DataFlow::globalAccessPathRootPseudoNode())
@@ -482,6 +487,7 @@ module AccessPath {
482487
*
483488
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
484489
*/
490+
overlay[caller]
485491
pragma[inline]
486492
DataFlow::Node getAReferenceOrAssignmentTo(string path) {
487493
result = getAReferenceTo(path)
@@ -494,6 +500,7 @@ module AccessPath {
494500
*
495501
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
496502
*/
503+
overlay[caller]
497504
pragma[inline]
498505
DataFlow::Node getAReferenceOrAssignmentTo(Root root, string path) {
499506
result = getAReferenceTo(root, path)
@@ -504,6 +511,7 @@ module AccessPath {
504511
/**
505512
* Holds if there is a step from `pred` to `succ` through an assignment to an access path.
506513
*/
514+
overlay[caller]
507515
pragma[inline]
508516
predicate step(DataFlow::Node pred, DataFlow::Node succ) {
509517
exists(string name, Root root |
@@ -521,6 +529,7 @@ module AccessPath {
521529
/**
522530
* Gets a `SourceNode` that refers to the same value or access path as the given node.
523531
*/
532+
overlay[caller]
524533
pragma[inline]
525534
DataFlow::SourceNode getAnAliasedSourceNode(DataFlow::Node node) {
526535
exists(DataFlow::SourceNode root, string accessPath |

javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,7 @@ private predicate stringifiedNode(Node node) {
14931493
}
14941494

14951495
/** Gets the post-update node for which `node` is the corresponding pre-update node. */
1496+
pragma[nomagic]
14961497
private Node getPostUpdateForStore(Node base) {
14971498
exists(Expr expr |
14981499
base = TValueNode(expr) and
@@ -1515,6 +1516,7 @@ private Node getPostUpdateForStore(Node base) {
15151516
}
15161517

15171518
/** Gets node to target with a store to the given `base` object.. */
1519+
overlay[caller]
15181520
pragma[inline]
15191521
private Node getStoreTarget(DataFlow::Node base) {
15201522
result = getPostUpdateForStore(base)

javascript/ql/lib/semmle/javascript/internal/BasicBlockInternal.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ module Public {
320320
/**
321321
* Holds if this basic block strictly dominates `bb`.
322322
*/
323+
overlay[caller]
323324
pragma[inline]
324325
predicate strictlyDominates(ReachableBasicBlock bb) { this = immediateDominator+(bb) }
325326

@@ -328,12 +329,14 @@ module Public {
328329
*
329330
* This predicate is reflexive: each reachable basic block dominates itself.
330331
*/
332+
overlay[caller]
331333
pragma[inline]
332334
predicate dominates(ReachableBasicBlock bb) { this = immediateDominator*(bb) }
333335

334336
/**
335337
* Holds if this basic block strictly post-dominates `bb`.
336338
*/
339+
overlay[caller]
337340
pragma[inline]
338341
predicate strictlyPostDominates(ReachableBasicBlock bb) { this = immediatePostDominator+(bb) }
339342

@@ -342,6 +345,7 @@ module Public {
342345
*
343346
* This predicate is reflexive: each reachable basic block post-dominates itself.
344347
*/
348+
overlay[caller]
345349
pragma[inline]
346350
predicate postDominates(ReachableBasicBlock bb) { this = immediatePostDominator*(bb) }
347351
}

0 commit comments

Comments
 (0)