I want to create an import to my CodeQL query.
I want that this import will be named Utils
and I will created inside it a predicate named isNumber
.
How can I creat such import?
This how I want my code to look like:
import cpp
import Utils
where
if exists(...)
then isNumber(size.(VariableAccess).getTarget())
else ...
select ...
I don't know how I create the Utils
import, it writes:
Could not resolve module Utils
I tried to create a folder named Utils
near my code query (code.ql
) but it didn't work.
I found how to do it.
Need to create a file named Utils.qll
in the same folder of your CodeQL query.
This is its code:
import cpp
predicate isNumber(Variable v){
v.getUnspecifiedType() instanceof IntegralType
}