Skip to content

Commit 7983b16

Browse files
committed
C++: Simplify and generalize EscapesTree::addressMayEscapeMutablyAt predicate.
1 parent 14a03e2 commit 7983b16

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/EscapesTree.qll

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,9 @@ private predicate addressMayEscapeAt(Expr e) {
212212

213213
private predicate addressMayEscapeMutablyAt(Expr e) {
214214
addressMayEscapeAt(e) and
215-
exists(Type t | t = e.getType().getUnderlyingType() |
216-
exists(PointerType pt |
217-
pt = t
218-
or
219-
pt = t.(SpecifiedType).getBaseType()
220-
|
221-
not pt.getBaseType().isConst()
222-
)
215+
exists(Type t | t = e.getType().getUnderlyingType().stripTopLevelSpecifiers() |
216+
t instanceof PointerType and
217+
not t.(PointerType).getBaseType().isConst()
223218
or
224219
t instanceof ReferenceType and
225220
not t.(ReferenceType).getBaseType().isConst()

0 commit comments

Comments
 (0)