Add isVariadic() on FuncDecl and Function

This commit is contained in:
Owen Mansel-Chan
2021-10-31 13:57:59 +00:00
parent 245d85ae97
commit e6a57b22a2
2 changed files with 8 additions and 0 deletions

View File

@@ -137,6 +137,8 @@ class FuncDef extends @funcdef, StmtParent, ExprParent {
*/
DataFlow::CallNode getACall() { result.getACallee() = this }
predicate isVariadic() { getType().isVariadic() }
override string getAPrimaryQlClass() { result = "FuncDef" }
}

View File

@@ -377,6 +377,12 @@ class Function extends ValueEntity, @functionobject {
/** Gets the declaration of this function, if any. */
FuncDecl getFuncDecl() { none() }
predicate isVariadic() {
this.(BuiltinFunction).getName() = ["append", "make", "print", "println"]
or
this.(DeclaredFunction).getFuncDecl().isVariadic()
}
/** Holds if this function has no observable side effects. */
predicate mayHaveSideEffects() { none() }