AST-dump

Why do you care whether the default constructor is trivial? Wouldn’t you also want to delete trivial constructors here?

What doesn’t match here is hasMethod(constructorDecl(isDefinition())).
hasMethod will not loop over all declarations, but just the ones made in the recordDecl.

To your specific problem (and tying into my above question): why not just constructorDecl(parameterCountIs(0), unless(isImplicit())

Well, my purpose is to delete it so that the compiler provides one. It is pointless to delete it if the compiler is going to provide the same constructor again. There is no change, but if there isn’t another option…

Maybe, I can look for the matcher you suggest “constructorDecl(parameterCountIs(0), unless(isImplicit())” and then only go on with the process determining if the constructor matched is a definition and it is not trivial as I was trying to do inside the matcher. Is that ok?

Thanks,

Pedro.

El dia 10 jun 2013 11:49, Manuel Klimek klimek@google.com escribió:

Why do you care whether the default constructor is trivial? Wouldn't you
also want to delete trivial constructors here?

What doesn't match here is hasMethod(constructorDecl(isDefinition())).
hasMethod will *not* loop over all declarations, but just the ones made in
the recordDecl.

To your specific problem (and tying into my above question): why not just
constructorDecl(parameterCountIs(0), unless(isImplicit())

Well, my purpose is to delete it so that the compiler provides one. It is
pointless to delete it if the compiler is going to provide the same
constructor again. There is no change, but if there isn't another option...

I don't think it's pointless to delete code that's unnecessary :slight_smile:

Maybe, I can look for the matcher you suggest
"constructorDecl(parameterCountIs(0), unless(isImplicit())" and then only
go on with the process determining if the constructor matched is a
definition and it is not trivial as I was trying to do inside the matcher.
Is that ok?

Well, you first have to get to the actual definition. Since it's not in the
class, you could take the declaration you found and look for redeclarations
that are definitions - one could build a matcher for that that would work
like hasRedeclaration(...).

Cheers,
/Manuel