File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,12 @@ class Node extends TIRDataFlowNode {
231
231
/** Gets the positional parameter corresponding to this node, if any. */
232
232
Parameter asParameter ( ) { result = asParameter ( 0 ) }
233
233
234
+ /**
235
+ * Gets the uninitialized local variable corresponding to this node, if
236
+ * any.
237
+ */
238
+ LocalVariable asUninitialized ( ) { result = this .( UninitializedNode ) .getLocalVariable ( ) }
239
+
234
240
/**
235
241
* Gets the positional parameter corresponding to the node that represents
236
242
* the value of the parameter after `index` number of loads, if any. For
@@ -666,6 +672,25 @@ class IndirectOperand extends Node, TIndirectOperand {
666
672
}
667
673
}
668
674
675
+ /**
676
+ * The value of an uninitialized local variable, viewed as a node in a data
677
+ * flow graph.
678
+ */
679
+ class UninitializedNode extends Node {
680
+ LocalVariable v ;
681
+
682
+ UninitializedNode ( ) {
683
+ exists ( Ssa:: Def def |
684
+ def .getDefiningInstruction ( ) instanceof UninitializedInstruction and
685
+ Ssa:: nodeToDefOrUse ( this , def ) and
686
+ v = def .getSourceVariable ( ) .getBaseVariable ( ) .( Ssa:: BaseIRVariable ) .getIRVariable ( ) .getAst ( )
687
+ )
688
+ }
689
+
690
+ /** Gets the uninitialized local variable corresponding to this node. */
691
+ LocalVariable getLocalVariable ( ) { result = v }
692
+ }
693
+
669
694
/**
670
695
* INTERNAL: Do not use.
671
696
*
You can’t perform that action at this time.
0 commit comments