JS: Add some overlay[caller] and a pragma[nomagic] annotations

This commit is contained in:
Asger F
2025-10-15 10:46:42 +02:00
parent 889209719b
commit 66febb263d
3 changed files with 15 additions and 0 deletions

View File

@@ -356,6 +356,7 @@ module AccessPath {
* Gets a variable that is relevant for the computations in the `GetLaterAccess` module.
* This predicate restricts as much as it can, but without depending on `getAVariableRef`.
*/
overlay[caller]
pragma[inline]
private SsaVariable getARelevantVariableSimple() {
// The variable might be used where `getLaterBaseAccess()` is called.
@@ -407,6 +408,7 @@ module AccessPath {
* }
* ```
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAReferenceTo(Root root, string path) {
path = fromReference(result, root) and
@@ -430,6 +432,7 @@ module AccessPath {
* })(NS = NS || {});
* ```
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAReferenceTo(string path) {
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode())
@@ -451,6 +454,7 @@ module AccessPath {
* }
* ```
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAnAssignmentTo(Root root, string path) {
path = fromRhs(result, root) and
@@ -472,6 +476,7 @@ module AccessPath {
* })(foo = foo || {});
* ```
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAnAssignmentTo(string path) {
path = fromRhs(result, DataFlow::globalAccessPathRootPseudoNode())
@@ -482,6 +487,7 @@ module AccessPath {
*
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAReferenceOrAssignmentTo(string path) {
result = getAReferenceTo(path)
@@ -494,6 +500,7 @@ module AccessPath {
*
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
*/
overlay[caller]
pragma[inline]
DataFlow::Node getAReferenceOrAssignmentTo(Root root, string path) {
result = getAReferenceTo(root, path)
@@ -504,6 +511,7 @@ module AccessPath {
/**
* Holds if there is a step from `pred` to `succ` through an assignment to an access path.
*/
overlay[caller]
pragma[inline]
predicate step(DataFlow::Node pred, DataFlow::Node succ) {
exists(string name, Root root |
@@ -521,6 +529,7 @@ module AccessPath {
/**
* Gets a `SourceNode` that refers to the same value or access path as the given node.
*/
overlay[caller]
pragma[inline]
DataFlow::SourceNode getAnAliasedSourceNode(DataFlow::Node node) {
exists(DataFlow::SourceNode root, string accessPath |

View File

@@ -1493,6 +1493,7 @@ private predicate stringifiedNode(Node node) {
}
/** Gets the post-update node for which `node` is the corresponding pre-update node. */
pragma[nomagic]
private Node getPostUpdateForStore(Node base) {
exists(Expr expr |
base = TValueNode(expr) and
@@ -1515,6 +1516,7 @@ private Node getPostUpdateForStore(Node base) {
}
/** Gets node to target with a store to the given `base` object.. */
overlay[caller]
pragma[inline]
private Node getStoreTarget(DataFlow::Node base) {
result = getPostUpdateForStore(base)

View File

@@ -320,6 +320,7 @@ module Public {
/**
* Holds if this basic block strictly dominates `bb`.
*/
overlay[caller]
pragma[inline]
predicate strictlyDominates(ReachableBasicBlock bb) { this = immediateDominator+(bb) }
@@ -328,12 +329,14 @@ module Public {
*
* This predicate is reflexive: each reachable basic block dominates itself.
*/
overlay[caller]
pragma[inline]
predicate dominates(ReachableBasicBlock bb) { this = immediateDominator*(bb) }
/**
* Holds if this basic block strictly post-dominates `bb`.
*/
overlay[caller]
pragma[inline]
predicate strictlyPostDominates(ReachableBasicBlock bb) { this = immediatePostDominator+(bb) }
@@ -342,6 +345,7 @@ module Public {
*
* This predicate is reflexive: each reachable basic block post-dominates itself.
*/
overlay[caller]
pragma[inline]
predicate postDominates(ReachableBasicBlock bb) { this = immediatePostDominator*(bb) }
}