Hi folks,
I was wondering what is the best way to get to the CXXCtroInitializer from child.
In code like this:
struct A {
A() : a(false), c(false) {}
unsigned a : 1;
unsigned c : 3;
};
I am looking for implicit casts from bool.
I added CXXCtorInitializer into hasParent like this:
const internal::ArgumentAdaptingMatcherFunc<
internal::HasParentMatcher,
internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, CXXCtorInitializer>,
internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
LLVM_ATTRIBUTE_UNUSED hasParent = {};
so clang-query doesn’t reject matcher:
implicitCastExpr(hasParent(cxxCtorInitializer()))
but it doesn’t match with anything.
I also tried something like this:
auto matcher = hasAncestor(cxxConstructorDecl(hasAnyConstructorInitializer(
cxxCtorInitializer(forField(isOneBitBitField()),
withInitializer(implicitCastExpr(equalsBoundNode(“cast”)))
))));
and then
implicitCastExpr(matcher).bind(“cast”)
but it doesn’t seems to work either.
Any thoughts?
Piotr