Skip to content

Commit f4d35f6

Browse files
committed
QL: QL: Add a query that finds missing noinline or nomagic annotations.
1 parent c9bfd85 commit f4d35f6

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @name Missing `noinline` or `nomagic` annotation
3+
* @description When a predicate is factored out to improve join-ordering, it should be marked as `noinline` or `nomagic`.
4+
* @kind problem
5+
* @problem.severity error
6+
* @id ql/missing-noinline
7+
* @tags performance
8+
* @precision high
9+
*/
10+
11+
import ql
12+
13+
from QLDoc doc, Predicate decl
14+
where
15+
doc.getContents().matches(["%join order%", "%join-order%"]) and
16+
decl.getQLDoc() = doc and
17+
not decl.getAnAnnotation() instanceof NoInline and
18+
not decl.getAnAnnotation() instanceof NoMagic and
19+
not decl.getAnAnnotation() instanceof NoOpt and
20+
// If it's marked as inline it's probably because the QLDoc says something like
21+
// "this predicate is inlined because it gives a better join-order".
22+
not decl.getAnAnnotation() instanceof Inline
23+
select decl, "This predicate might be inlined."

0 commit comments

Comments
 (0)