Skip to content

Commit 142e1cb

Browse files
committed
C++: Implement AggregateLiteral.mayBeImpure()
1 parent 49276e0 commit 142e1cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpp/ql/src/semmle/code/cpp/exprs/Literal.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class HexLiteral extends Literal {
132132
* A C/C++ aggregate literal.
133133
*/
134134
class AggregateLiteral extends Expr, @aggregateliteral {
135-
// if this is turned into a Literal we need to change mayBeImpure
136135
override string getCanonicalQLClass() { result = "AggregateLiteral" }
137136

138137
/**
@@ -145,6 +144,10 @@ class AggregateLiteral extends Expr, @aggregateliteral {
145144
result = this.(ClassAggregateLiteral).getFieldExpr(f)
146145
}
147146

147+
override predicate mayBeImpure() { this.getAChild().mayBeImpure() }
148+
149+
override predicate mayBeGloballyImpure() { this.getAChild().mayBeGloballyImpure() }
150+
148151
/** Gets a textual representation of this aggregate literal. */
149152
override string toString() { result = "{...}" }
150153
}

0 commit comments

Comments
 (0)