Skip to content

Commit 86e7919

Browse files
committed
C++: Simplify 'isGlobalUse' and 'isGlobalDefImpl'.
1 parent 9762313 commit 86e7919

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,10 @@ private newtype TDefOrUseImpl =
143143
private predicate isGlobalUse(
144144
GlobalLikeVariable v, IRFunction f, int indirection, int indirectionIndex
145145
) {
146-
exists(VariableAddressInstruction vai, int defIndex |
146+
exists(VariableAddressInstruction vai |
147147
vai.getEnclosingIRFunction() = f and
148148
vai.getAstVariable() = v and
149-
isDef(_, _, _, vai, indirection, defIndex) and
150-
indirectionIndex = [0 .. defIndex] + 1
149+
isDef(_, _, _, vai, indirection, indirectionIndex)
151150
)
152151
}
153152

@@ -158,7 +157,7 @@ private predicate isGlobalDefImpl(
158157
vai.getEnclosingIRFunction() = f and
159158
vai.getAstVariable() = v and
160159
isUse(_, _, vai, indirection, indirectionIndex) and
161-
not isDef(_, _, vai.getAUse(), _, _, _)
160+
not isDef(_, _, _, vai, _, indirectionIndex)
162161
)
163162
}
164163

0 commit comments

Comments
 (0)