@@ -104,6 +104,7 @@ overlay[local?]
104104module ;
105105
106106private import go
107+ private import semmle.go.controlflow.Guards
107108private import internal.ExternalFlowExtensions:: Extensions as Extensions
108109private import FlowSummary as FlowSummary
109110private import internal.DataFlowPrivate
@@ -459,24 +460,23 @@ private module Cached {
459460 private newtype TKindModelPair =
460461 TMkPair ( string kind , string model ) { isBarrierGuardNode ( _, _, kind , model ) }
461462
462- private boolean convertAcceptingValue ( Public:: AcceptingValue av ) {
463- av .isTrue ( ) and result = true
463+ private GuardValue convertAcceptingValue ( Public:: AcceptingValue av ) {
464+ av .isTrue ( ) and result . asBooleanValue ( ) = true
464465 or
465- av .isFalse ( ) and result = false
466- // Remaining cases are not supported yet, they depend on the shared Guards library.
467- // or
468- // av.isNoException() and result.getDualValue().isThrowsException()
469- // or
470- // av.isZero() and result.asIntValue() = 0
471- // or
472- // av.isNotZero() and result.getDualValue().asIntValue() = 0
473- // or
474- // av.isNull() and result.isNullValue()
475- // or
476- // av.isNotNull() and result.isNonNullValue()
466+ av .isFalse ( ) and result .asBooleanValue ( ) = false
467+ or
468+ av .isNoException ( ) and result .getDualValue ( ) .isThrowsException ( )
469+ or
470+ av .isZero ( ) and result .asIntValue ( ) = 0
471+ or
472+ av .isNotZero ( ) and result .getDualValue ( ) .asIntValue ( ) = 0
473+ or
474+ av .isNull ( ) and result .isNullValue ( )
475+ or
476+ av .isNotNull ( ) and result .isNonNullValue ( )
477477 }
478478
479- private predicate barrierGuardChecks ( DataFlow :: Node g , Expr e , boolean gv , TKindModelPair kmp ) {
479+ private predicate barrierGuardChecks ( Guard g , Expr e , GuardValue gv , TKindModelPair kmp ) {
480480 exists (
481481 SourceSinkInterpretationInput:: InterpretNode n , Public:: AcceptingValue acceptingValue ,
482482 string kind , string model
@@ -486,7 +486,7 @@ private module Cached {
486486 kmp = TMkPair ( kind , model ) and
487487 gv = convertAcceptingValue ( acceptingValue )
488488 |
489- g .asExpr ( ) . ( CallExpr ) .getAnArgument ( ) = e // TODO: qualifier?
489+ g .( CallExpr ) .getAnArgument ( ) = e // TODO: qualifier?
490490 )
491491 }
492492
@@ -500,7 +500,7 @@ private module Cached {
500500 isBarrierNode ( n , kind , model ) and n .asNode ( ) = node
501501 )
502502 or
503- DataFlow:: ParameterizedBarrierGuard < TKindModelPair , barrierGuardChecks / 4 > :: getABarrierNode ( TMkPair ( kind ,
503+ DataFlow:: ParameterizedBarrierGuardValue < TKindModelPair , barrierGuardChecks / 4 > :: getABarrierNode ( TMkPair ( kind ,
504504 model ) ) = node
505505 }
506506}
0 commit comments