unsigned int x = __dredd_replace_expr_unsigned_int(__dredd_replace_expr_int(1, 0), 6);
with the following AST.
FunctionDecl 0x55d773f60890 </home/ubuntu/dredd/examples/simple/cast.cc:1:1, line:3:1> line:1:5 main 'int ()'
`-CompoundStmt 0x55d773f60a80 <col:12, line:3:1>
`-DeclStmt 0x55d773f60a68 <line:2:3, col:21>
`-VarDecl 0x55d773f609c8 <col:3, col:20> col:16 x 'unsigned int' cinit
`-ImplicitCastExpr 0x55d773f60a50 <col:20> 'unsigned int' <IntegralCast>
`-IntegerLiteral 0x55d773f60a30 <col:20> 'int' 1
Am I right to assume that __dredd_replace_expr_int is the result of mutation on IntegerLiteral, and __dredd_replace_expr_unsigned_int is the result of mutation on ImplicitCastExpr?
If that the case, consider another example with similar AST:
#include <initializer_list>
class foo {
public:
foo(std::initializer_list<unsigned>) {}
};
int main() {
foo{2};
}
So, __dredd_replace_expr_int is the result of mutation on IntegerLiteral as previous. Why isn't there __dredd_replace_expr_unsigned_int acting on ImplicitCastExpr?
Seems like Dredd doesn't mutate ImplicitCastExpr in the second example because it is not a supported type and thus fail the check here. More specifically, it is not a clang::BuiltinType for some reason.
Applying dredd to
mutate the declaration statement to
with the following AST.
Am I right to assume that
__dredd_replace_expr_int
is the result of mutation onIntegerLiteral
, and__dredd_replace_expr_unsigned_int
is the result of mutation onImplicitCastExpr
?If that the case, consider another example with similar AST:
which mutate the one line in
foo{2}
towith the following AST:
So,
__dredd_replace_expr_int
is the result of mutation onIntegerLiteral
as previous. Why isn't there__dredd_replace_expr_unsigned_int
acting onImplicitCastExpr
?