Merge remote-tracking branch 'rc/1.21' into master

This commit is contained in:
Esben Sparre Andreasen
2019-06-12 12:57:55 +02:00
48 changed files with 616 additions and 32 deletions

View File

@@ -356,7 +356,8 @@ cached module SsaSource {
/** Holds if `v` is used as the receiver in a method call. */
cached predicate method_call_refinement(Variable v, ControlFlowNode use, CallNode call) {
use = v.getAUse() and
call.getFunction().(AttrNode).getObject() = use
call.getFunction().(AttrNode).getObject() = use and
not test_contains(_, call)
}
/** Holds if `v` is defined by assignment at `defn` and given `value`. */

View File

@@ -155,7 +155,12 @@ class PackageObjectInternal extends ModuleObjectInternal, TPackageObject {
/** Gets the submodule `name` of this package */
ModuleObjectInternal submodule(string name) {
result.getName() = this.getName() + "." + name
exists(string fullName, int lastDotIndex |
fullName = result.getName() and
lastDotIndex = max(fullName.indexOf(".")) and
name = fullName.substring(lastDotIndex + 1, fullName.length()) and
this.getName() = fullName.substring(0, lastDotIndex)
)
}
override int intValue() {

View File

@@ -170,6 +170,11 @@ module PointsTo {
cached module PointsToInternal {
pragma[noinline]
cached predicate importCtxPointsTo(ControlFlowNode f, ObjectInternal value, ControlFlowNode origin) {
PointsToInternal::pointsTo(f, any(Context ctx | ctx.isImport()), value, origin)
}
/** INTERNAL -- Use `f.refersTo(value, origin)` instead. */
cached predicate pointsTo(ControlFlowNode f, PointsToContext context, ObjectInternal value, ControlFlowNode origin) {
points_to_candidate(f, context, value, origin) and
@@ -695,7 +700,7 @@ private module InterModulePointsTo {
predicate ofInterestInExports(ModuleObjectInternal mod, string name) {
exists(ImportStarNode imp, ImportStarRefinement def, EssaVariable var |
imp = def.getDefiningNode() and
PointsToInternal::pointsTo(imp.getModule(), any(Context ctx | ctx.isImport()), mod, _) and
PointsToInternal::importCtxPointsTo(imp.getModule(), mod, _) and
var = def.getVariable()
|
if var.isMetaVariable() then (
@@ -891,7 +896,7 @@ module InterProceduralPointsTo {
/** Helper for parameter_points_to */
pragma [noinline]
private predicate default_parameter_points_to(ParameterDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin) {
exists(PointsToContext imp | imp.isImport() | PointsToInternal::pointsTo(def.getDefault(), imp, value, origin)) and
PointsToInternal::importCtxPointsTo(def.getDefault(), value, origin) and
context_for_default_value(def, context)
}
@@ -2211,7 +2216,7 @@ cached module ModuleAttributes {
private predicate importStarDef(ImportStarRefinement def, EssaVariable input, ModuleObjectInternal mod) {
exists(ImportStarNode imp |
def.getVariable().getName() = "$" and imp = def.getDefiningNode() and
input = def.getInput() and PointsToInternal::pointsTo(imp.getModule(), any(Context ctx | ctx.isImport()), mod, _)
input = def.getInput() and PointsToInternal::importCtxPointsTo(imp.getModule(), mod, _)
)
}