@@ -34,20 +34,28 @@ predicate isTypeZeroInitializable(Type t) {
3434}
3535
3636/*
37- * Returns true if the given call may be evaluated at compile time and is compile time evaluated because
38- * all its arguments are compile time evaluated and its default values are compile time evaluated.
39- */
37+ * Returns true if the given call may be evaluated at compile time and is compile time evaluated because
38+ * all its arguments are compile time evaluated and its default values are compile time evaluated.
39+ */
40+
4041predicate isCompileTimeEvaluated ( Call call ) {
4142 // 1. The call may be evaluated at compile time, because it is constexpr, and
4243 call .getTarget ( ) .isConstexpr ( ) and
4344 // 2. all its arguments are compile time evaluated, and
44- forall ( DataFlow:: Node ultimateArgSource | DataFlow:: localFlow ( ultimateArgSource , DataFlow:: exprNode ( call .getAnArgument ( ) ) ) and not DataFlow:: localFlowStep ( _, ultimateArgSource ) |
45+ forall ( DataFlow:: Node ultimateArgSource |
46+ DataFlow:: localFlow ( ultimateArgSource , DataFlow:: exprNode ( call .getAnArgument ( ) ) ) and
47+ not DataFlow:: localFlowStep ( _, ultimateArgSource )
48+ |
4549 ultimateArgSource .asExpr ( ) instanceof Literal
4650 or
4751 any ( Call c | isCompileTimeEvaluated ( c ) ) = ultimateArgSource .asExpr ( )
4852 ) and
4953 // 3. all the default values used are compile time evaluated.
50- forall ( Expr defaultValue , Parameter parameterUsingDefaultValue , int idx | parameterUsingDefaultValue = call .getTarget ( ) .getParameter ( idx ) and not exists ( call .getArgument ( idx ) ) and parameterUsingDefaultValue .getAnAssignedValue ( ) = defaultValue |
54+ forall ( Expr defaultValue , Parameter parameterUsingDefaultValue , int idx |
55+ parameterUsingDefaultValue = call .getTarget ( ) .getParameter ( idx ) and
56+ not exists ( call .getArgument ( idx ) ) and
57+ parameterUsingDefaultValue .getAnAssignedValue ( ) = defaultValue
58+ |
5159 defaultValue instanceof Literal
5260 or
5361 any ( Call c | isCompileTimeEvaluated ( c ) ) = defaultValue
0 commit comments