QL4QL: Extend ql/inline-overlay-caller

This commit is contained in:
Kasper Svendsen
2025-06-24 11:29:36 +02:00
parent e8a08a6b96
commit e1fc138670
4 changed files with 19 additions and 3 deletions

View File

@@ -2542,6 +2542,10 @@ private class CallerArg extends AnnotationArg {
CallerArg() { this.getValue() = "caller" }
}
private class CallerQArg extends AnnotationArg {
CallerQArg() { this.getValue() = "caller?" }
}
private class LocalArg extends AnnotationArg {
LocalArg() { this.getValue() = "local" }
}
@@ -2616,6 +2620,13 @@ class OverlayCaller extends Annotation {
override string toString() { result = "overlay[caller]" }
}
/** An `overlay[caller?]` annotation. */
class OverlayCallerQ extends Annotation {
OverlayCallerQ() { this.getName() = "overlay" and this.getArgs(0) instanceof CallerQArg }
override string toString() { result = "overlay[caller?]" }
}
/** An `overlay[local]` annotation. */
class OverlayLocal extends Annotation {
OverlayLocal() { this.getName() = "overlay" and this.getArgs(0) instanceof LocalArg }

View File

@@ -31,11 +31,12 @@ where
mayBeLocal(p) and
p.getAnAnnotation() instanceof Inline and
not p.getAnAnnotation() instanceof OverlayCaller and
not p.getAnAnnotation() instanceof OverlayCallerQ and
not p.isPrivate()
select p,
"This possibly local non-private inline predicate will not " +
"be inlined across the overlay frontier. This may negatively " +
"affect evaluation performance. Consider adding an " +
"`overlay[caller]` annotation to allow inlining across the " +
"overlay frontier. Note that adding an `overlay[caller]` " +
"`overlay[caller]` or `overlay[caller?]` annotation to allow inlining across the " +
"overlay frontier. Note that adding an `overlay[caller]` or `overlay[caller?]` " +
"annotation affects semantics under overlay evaluation."

View File

@@ -1 +1 @@
| Test.qll:7:11:7:13 | ClasslessPredicate foo | This possibly local non-private inline predicate will not be inlined across the overlay frontier. This may negatively affect evaluation performance. Consider adding an `overlay[caller]` annotation to allow inlining across the overlay frontier. Note that adding an `overlay[caller]` annotation affects semantics under overlay evaluation. |
| Test.qll:7:11:7:13 | ClasslessPredicate foo | This possibly local non-private inline predicate will not be inlined across the overlay frontier. This may negatively affect evaluation performance. Consider adding an `overlay[caller]` or `overlay[caller?]` annotation to allow inlining across the overlay frontier. Note that adding an `overlay[caller]` or `overlay[caller?]` annotation affects semantics under overlay evaluation. |

View File

@@ -12,3 +12,7 @@ predicate bar(int x) { x = 43 }
pragma[inline]
private predicate baz(int x) { x = 44 }
overlay[caller?]
pragma[inline]
predicate baw(int x) { x = 45 }