Skip to content

Commit 48460e3

Browse files
authored
Merge pull request github#4716 from criemen/escapestree-code-cleanup
C++: Simplify and generalize EscapesTree::addressMayEscapeMutablyAt
2 parents 9b07782 + 026abae commit 48460e3

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().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)