mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
More performance stuff. (Possibly not all needed.)
This commit is contained in:
@@ -229,14 +229,18 @@ private predicate method_callsite_defn(MethodCallsiteRefinement def, Definition
|
||||
pragma [noinline]
|
||||
private predicate module_and_name_for_import_star(ModuleObject mod, string name, ImportStarRefinement def) {
|
||||
exists(ImportStarNode im_star |
|
||||
im_star = def.getDefiningNode() |
|
||||
name = def.getSourceVariable().getName() and
|
||||
im_star.getModule().refersTo(mod) and
|
||||
module_and_name_for_import_star_helper(mod, name, im_star, def) and
|
||||
mod.exports(name)
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if `def` is technically a defn of `var`, but the `from ... import *` does not in fact define `var` */
|
||||
pragma [noinline]
|
||||
private predicate module_and_name_for_import_star_helper(ModuleObject mod, string name, ImportStarNode im_star, ImportStarRefinement def) {
|
||||
im_star = def.getDefiningNode() and
|
||||
im_star.getModule().refersTo(mod) and
|
||||
name = def.getSourceVariable().getName()
|
||||
}
|
||||
/** Holds if `def` is technically a defn of `var`, but the `from ... import *` does not in fact define `var` */
|
||||
pragma [noinline]
|
||||
private predicate variable_not_redefined_by_import_star(EssaVariable var, ImportStarRefinement def) {
|
||||
var = def.getInput() and
|
||||
|
||||
@@ -667,12 +667,18 @@ private module InterModulePointsTo {
|
||||
pragma [noinline]
|
||||
private EssaVariable ssa_variable_for_module_attribute(ImportMemberNode f, PointsToContext context) {
|
||||
exists(string name, ModuleObjectInternal mod, Module m |
|
||||
mod.getSourceModule() = m and m = f.getEnclosingModule() and m = result.getScope() and
|
||||
mod.getSourceModule() = m and m = result.getScope() and
|
||||
PointsToInternal::pointsTo(f.getModule(name), context, mod, _) and
|
||||
result.getSourceVariable().getName() = name and result.getAUse() = f
|
||||
result = ssa_helper(f, name, m)
|
||||
)
|
||||
}
|
||||
|
||||
pragma [noinline]
|
||||
private EssaVariable ssa_helper(ImportMemberNode f, string name, Module m) {
|
||||
result.getSourceVariable().getName() = name and result.getAUse() = f
|
||||
and m = f.getEnclosingModule()
|
||||
}
|
||||
|
||||
/* Helper for implicit_submodule_points_to */
|
||||
private ModuleObjectInternal getModule(ImplicitSubModuleDefinition def) {
|
||||
exists(PackageObjectInternal package |
|
||||
|
||||
@@ -142,7 +142,12 @@ class ReModulePointToExtension extends PointsToExtension {
|
||||
sre_constants.attribute("SRE_FLAG_" + name, value, orig) and
|
||||
origin = orig.asCfgNodeOrHere(this)
|
||||
)
|
||||
and context.appliesTo(this)
|
||||
and pointsTo_helper(context)
|
||||
}
|
||||
|
||||
pragma [noinline]
|
||||
predicate pointsTo_helper(Context context) {
|
||||
context.appliesTo(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user