@@ -2583,10 +2583,10 @@ class NodeRegion instanceof ControlFlow::BasicBlock {
25832583 * Holds if the nodes in `nr` are unreachable when the call context is `call`.
25842584 */
25852585predicate isUnreachableInCall ( NodeRegion nr , DataFlowCall call ) {
2586- exists ( ExplicitParameterNode paramNode , Guard guard , ControlFlow :: BooleanSuccessor bs |
2587- viableConstantBooleanParamArg ( paramNode , bs . getValue ( ) . booleanNot ( ) , call ) and
2586+ exists ( ExplicitParameterNode paramNode , Guard guard , GuardValue val |
2587+ viableConstantParamArg ( paramNode , val . getDualValue ( ) , call ) and
25882588 paramNode .getSsaDefinition ( ) .getARead ( ) = guard and
2589- guard .controlsBlock ( nr , bs , _ )
2589+ guard .valueControls ( nr , val )
25902590 )
25912591}
25922592
@@ -2904,33 +2904,19 @@ class CastNode extends Node {
29042904
29052905class DataFlowExpr = Expr ;
29062906
2907- /** Holds if `e` is an expression that always has the same Boolean value `val`. */
2908- private predicate constantBooleanExpr ( Expr e , boolean val ) {
2909- e .getType ( ) instanceof BoolType and
2910- e .getValue ( ) = val .toString ( )
2911- or
2912- exists ( Ssa:: ExplicitDefinition def , Expr src |
2913- e = def .getARead ( ) and
2914- src = def .getADefinition ( ) .getSource ( ) and
2915- constantBooleanExpr ( src , val )
2916- )
2917- }
2907+ /** An argument that always has the same value. */
2908+ private class ConstantArgumentNode extends ExprNode {
2909+ ConstantArgumentNode ( ) { Guards:: InternalUtil:: exprHasValue ( this .( ArgumentNode ) .asExpr ( ) , _) }
29182910
2919- /** An argument that always has the same Boolean value. */
2920- private class ConstantBooleanArgumentNode extends ExprNode {
2921- ConstantBooleanArgumentNode ( ) { constantBooleanExpr ( this .( ArgumentNode ) .asExpr ( ) , _) }
2922-
2923- /** Gets the Boolean value of this expression. */
2924- boolean getBooleanValue ( ) { constantBooleanExpr ( this .getExpr ( ) , result ) }
2911+ /** Gets the value of this expression. */
2912+ GuardValue getValue ( ) { Guards:: InternalUtil:: exprHasValue ( this .getExpr ( ) , result ) }
29252913}
29262914
29272915pragma [ noinline]
2928- private predicate viableConstantBooleanParamArg (
2929- ParameterNode paramNode , boolean b , DataFlowCall call
2930- ) {
2931- exists ( ConstantBooleanArgumentNode arg |
2916+ private predicate viableConstantParamArg ( ParameterNode paramNode , GuardValue val , DataFlowCall call ) {
2917+ exists ( ConstantArgumentNode arg |
29322918 viableParamArg ( call , paramNode , arg ) and
2933- b = arg .getBooleanValue ( )
2919+ val = arg .getValue ( )
29342920 )
29352921}
29362922
0 commit comments