File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
cpp/ql/src/semmle/code/cpp/controlflow Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,20 @@ private predicate addressTakenVariable(StackVariable var) {
7373 )
7474}
7575
76+ /**
77+ * Holds if `v` is a stack-allocated reference-typed local variable. We don't
78+ * build SSA for such variables since they are likely to change values even
79+ * when not syntactically mentioned. For the same reason,
80+ * `addressTakenVariable` is used to prevent tracking variables that may be
81+ * aliased by such a reference.
82+ *
83+ * Reference-typed parameters are treated as if they weren't references.
84+ * That's because it's in practice highly unlikely that they alias other data
85+ * accessible from the function body.
86+ */
7687private predicate isReferenceVar ( StackVariable v ) {
77- v .getUnspecifiedType ( ) instanceof ReferenceType
88+ v .getUnspecifiedType ( ) instanceof ReferenceType and
89+ not v instanceof Parameter
7890}
7991
8092/**
You can’t perform that action at this time.
0 commit comments