From b3e23bcc319a2794fbb5aea66648e62f6e663e2c Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Mon, 31 May 2021 07:51:11 +0000 Subject: [PATCH] improve performance of type resolution --- ql/src/codeql_ql/ast/internal/Type.qll | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ql/src/codeql_ql/ast/internal/Type.qll b/ql/src/codeql_ql/ast/internal/Type.qll index 3de6e420144..216adbe89ac 100644 --- a/ql/src/codeql_ql/ast/internal/Type.qll +++ b/ql/src/codeql_ql/ast/internal/Type.qll @@ -266,12 +266,14 @@ predicate resolveTypeExpr(TypeExpr te, Type t) { if primTypeName(te.getClassName()) then t = TPrimitive(te.getClassName()) else - exists(FileOrModule m, boolean public | qualifier(te, m, public) | - defines(m, te.getClassName(), t, public) + exists(FileOrModule m, boolean public, string clName | qualifier(te, m, public, clName) | + defines(m, clName, t, public) ) } -private predicate qualifier(TypeExpr te, FileOrModule m, boolean public) { +pragma[noinline] +private predicate qualifier(TypeExpr te, FileOrModule m, boolean public, string clName) { + te.getClassName() = clName and if exists(te.getModule()) then ( public = true and m = te.getModule().getResolvedModule()