Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ql/ql/src/codeql_ql/ast/Ast.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}
Expand Down Expand Up @@ -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 }
Expand Down
5 changes: 3 additions & 2 deletions ql/ql/src/queries/overlay/InlineOverlayCaller.ql
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Original file line number Diff line number Diff line change
@@ -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. |
4 changes: 4 additions & 0 deletions ql/ql/test/queries/overlay/InlineOverlayCaller/Test.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Loading