mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
QL4QL: Extend ql/inline-overlay-caller
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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. |
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user