mirror of
https://github.com/github/codeql.git
synced 2026-02-08 03:01:10 +01:00
QL: Add a query that finds missing noinline or nomagic annotations.
This commit is contained in:
23
ql/src/queries/performance/MissingNoinline.ql
Normal file
23
ql/src/queries/performance/MissingNoinline.ql
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @name Missing `noinline` or `nomagic` annotation
|
||||
* @description When a predicate is factored out to improve join-ordering, it should be marked as `noinline` or `nomagic`.
|
||||
* @kind problem
|
||||
* @problem.severity error
|
||||
* @id ql/missing-noinline
|
||||
* @tags performance
|
||||
* @precision high
|
||||
*/
|
||||
|
||||
import ql
|
||||
|
||||
from QLDoc doc, Predicate decl
|
||||
where
|
||||
doc.getContents().matches(["%join order%", "%join-order%"]) and
|
||||
decl.getQLDoc() = doc and
|
||||
not decl.getAnAnnotation() instanceof NoInline and
|
||||
not decl.getAnAnnotation() instanceof NoMagic and
|
||||
not decl.getAnAnnotation() instanceof NoOpt and
|
||||
// If it's marked as inline it's probably because the QLDoc says something like
|
||||
// "this predicate is inlined because it gives a better join-order".
|
||||
not decl.getAnAnnotation() instanceof Inline
|
||||
select decl, "This predicate might be inlined."
|
||||
Reference in New Issue
Block a user