@@ -634,3 +634,28 @@ class UncertainWriteDefinition extends WriteDefinition {
634634 )
635635 }
636636}
637+
638+ /** Provides a set of consistency queries. */
639+ module Consistency {
640+ abstract class RelevantDefinition extends Definition {
641+ abstract predicate hasLocationInfo (
642+ string filepath , int startline , int startcolumn , int endline , int endcolumn
643+ ) ;
644+ }
645+
646+ query predicate nonUniqueDef ( RelevantDefinition def , SourceVariable v , BasicBlock bb , int i ) {
647+ ssaDefReachesRead ( v , def , bb , i ) and
648+ not exists ( unique( Definition def0 | ssaDefReachesRead ( _, def0 , bb , i ) ) )
649+ }
650+
651+ query predicate readWithoutDef ( SourceVariable v , BasicBlock bb , int i ) {
652+ variableRead ( bb , i , v , _) and
653+ not ssaDefReachesRead ( _, _, bb , i )
654+ }
655+
656+ query predicate deadDef ( RelevantDefinition def , SourceVariable v ) {
657+ v = def .getSourceVariable ( ) and
658+ not ssaDefReachesRead ( _, def , _, _) and
659+ not phiHasInputFromBlock ( _, def , _)
660+ }
661+ }
0 commit comments