Skip to content

Commit a23077a

Browse files
committed
C++: Comments for future maintainers
1 parent 260bfe7 commit a23077a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cpp/ql/src/semmle/code/cpp/Variable.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class StaticStorageDurationVariable extends Variable {
397397
*/
398398
private predicate runtimeExprInStaticInitializer(Expr e) {
399399
inStaticInitializer(e) and
400-
if e instanceof AggregateLiteral
400+
if e instanceof AggregateLiteral // in sync with the cast in `inStaticInitializer`
401401
then runtimeExprInStaticInitializer(e.getAChild())
402402
else not e.getFullyConverted().isConstant()
403403
}
@@ -409,6 +409,8 @@ private predicate runtimeExprInStaticInitializer(Expr e) {
409409
private predicate inStaticInitializer(Expr e) {
410410
exists(StaticStorageDurationVariable var | e = var.getInitializer().getExpr())
411411
or
412+
// The cast to `AggregateLiteral` ensures we only compute what'll later be
413+
// needed by `runtimeExprInStaticInitializer`.
412414
inStaticInitializer(e.getParent().(AggregateLiteral))
413415
}
414416

0 commit comments

Comments
 (0)