@@ -34,20 +34,28 @@ predicate isTypeZeroInitializable(Type t) {
34
34
}
35
35
36
36
/*
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
+
40
41
predicate isCompileTimeEvaluated ( Call call ) {
41
42
// 1. The call may be evaluated at compile time, because it is constexpr, and
42
43
call .getTarget ( ) .isConstexpr ( ) and
43
44
// 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
+ |
45
49
ultimateArgSource .asExpr ( ) instanceof Literal
46
50
or
47
51
any ( Call c | isCompileTimeEvaluated ( c ) ) = ultimateArgSource .asExpr ( )
48
52
) and
49
53
// 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
+ |
51
59
defaultValue instanceof Literal
52
60
or
53
61
any ( Call c | isCompileTimeEvaluated ( c ) ) = defaultValue
0 commit comments