@@ -439,30 +439,6 @@ private module Cached {
439439 result = DataFlowIntegrationImpl:: getABarrierNode ( guard , def , branch )
440440 }
441441 }
442-
443- bindingset [ def1, def2]
444- pragma [ inline_late]
445- private predicate sameSourceVariable ( Ssa:: Definition def1 , Ssa:: Definition def2 ) {
446- def1 .getSourceVariable ( ) = def2 .getSourceVariable ( )
447- }
448-
449- /**
450- * Gets an implicit entry definition for a captured variable that
451- * may be guarded, because a call to the capturing callable is guarded.
452- *
453- * This is restricted to calls where the variable is captured inside a
454- * block.
455- */
456- cached
457- Ssa:: CapturedEntryDefinition getAMaybeGuardedCapturedDef (
458- Cfg:: CfgNodes:: ExprCfgNode g , boolean branch , Ssa:: Definition def
459- ) {
460- exists ( Cfg:: CfgNodes:: ExprNodes:: CallCfgNode call |
461- DataFlowIntegrationInput:: guardControlsBlock ( g , call .getBasicBlock ( ) , branch ) and
462- result .getBasicBlock ( ) .getScope ( ) = call .getExpr ( ) .( MethodCall ) .getBlock ( ) and
463- sameSourceVariable ( def , result )
464- )
465- }
466442}
467443
468444import Cached
@@ -552,6 +528,8 @@ class ParameterExt extends TParameterExt {
552528}
553529
554530private module DataFlowIntegrationInput implements Impl:: DataFlowIntegrationInputSig {
531+ private import codeql.ruby.controlflow.internal.Guards as Guards
532+
555533 class Parameter = ParameterExt ;
556534
557535 class Expr extends Cfg:: CfgNodes:: ExprCfgNode {
@@ -570,11 +548,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
570548
571549 /** Holds if the guard `guard` controls block `bb` upon evaluating to `branch`. */
572550 predicate guardControlsBlock ( Guard guard , SsaInput:: BasicBlock bb , boolean branch ) {
573- exists ( Cfg:: ConditionBlock conditionBlock , Cfg:: SuccessorTypes:: ConditionalSuccessor s |
574- guard = conditionBlock .getLastNode ( ) and
575- s .getValue ( ) = branch and
576- conditionBlock .controls ( bb , s )
577- )
551+ Guards:: guardControlsBlock ( guard , bb , branch )
578552 }
579553
580554 /** Gets an immediate conditional successor of basic block `bb`, if any. */
0 commit comments