Matcher with expressions


Sorry to write you directly, but I have been sending this message since
two days ago to cfe-dev but my message is not posted and I need help as
soon as possible.

This is the message:

"Up to now, I have been using matchers to match declarations, but now, I
need to match an expression and I am having some problems.
I am looking for a CXXConstructExpr like the one marked in bold in the
next example:
class A{
   A() {...}
class B: public A{
     B () {* A (); *}
I think the matcher should follow this structure:
StatementMatcher CE = constructExpr(...);


1. If I put nothing within the parentheses, "A()" in class A, "B()" and
"A()" in class B are all retrieved. Therefore, I need to indicate that I do
not want the definitions. Thus, I thought about the matcher "isDefinition",
but it is only for the type "Decl", how can I solve this problem?
The only thing that I have found is the matcher "hasDeclaration", but I do
not know how this matcher could help me in this task.

I'm not sure what the question is. You do not want definitions of what?

2. I also need to ensure that the constructor invoked belongs to a parent
class. In the same way, when matching declarations I can ask if the
CXXConstructDecl "B()" is "ofClass(recordDecl(isDerivedFrom(...)))". But,
with an expression...

Use hasType to match on the type of an expression.