Skip to content

Commit

Permalink
Fix: reviewer comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanFoo0523 committed Jul 17, 2024
1 parent 19e736d commit 345b3e5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/libdredd/src/mutation_replace_expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,10 @@ void MutationReplaceExpr::ReplaceExprWithFunctionCall(
// but not for non-constants. This is catered for by inserting an explicit
// cast.
auto parents = ast_context.getParents<clang::Expr>(*expr_);
// This the expression occurs in an initializer list and is subject to an
// explicit cast then it will have at least two parents -- the initializer
// list, and the implicit cast. (This is probably due to implicit casts being
// treated as invisible nodes in the AST.)
// The expression that occurs in an initializer list and is then subject to an
// explicit cast will have at least two parents: the initializer list and the
// implicit cast. (This is probably due to implicit casts being treated as
// invisible nodes in the AST.)
if (ast_context.getLangOpts().CPlusPlus && parents.size() >= 2 &&
parents[0].get<clang::InitListExpr>() != nullptr &&
parents[1].get<clang::ImplicitCastExpr>() != nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion test/single_file/initializer_list_narrower_nested.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ struct foo {

void baz() {
foo bar[] = {{1, 2}};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ struct foo {

void baz() {
foo bar[] = {{static_cast<short>(__dredd_replace_expr_int_one(1, 0)), static_cast<short>(__dredd_replace_expr_int_constant(2, 3))}};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ struct foo {

void baz() {
foo bar[] = {{static_cast<short>(__dredd_replace_expr_int(1, 0)), static_cast<short>(__dredd_replace_expr_int(2, 6))}};
}
}

0 comments on commit 345b3e5

Please sign in to comment.