Detecting an out-of-class defaulted method

Clang AST novice here...

I have a CXXMethodDecl*, and I'm trying to determine whether it is
(a) marked `= default` in the class declaration,
(b) not `= default` in the class declaration, but `= default` in
    the outside-the-class definition, or
(c) neither.

Currently I'm doing this:

  if (Method->isExplicitlyDefaulted()) {
    if (Method->isUserProvided())
      defaulted_out_of_class;
    else
      defaulted_in_class;
  } else
    not_defaulted;

and I have a test case like

class foo {
  foo() = default;
  ~foo();
};
foo::~foo() = default;

The ctor is going through the defaulted_in_class path, but
the dtor is going through the not_defaulted path.

I've tried `Method->getCanonicalDecl()` instead of just `Method`
but the results are the same.

Any guidances/assistance appreciated!
Thanks,
--paulr

The canonical decl has no meaning other than its uniqueness over its redecls; I believe it is always just the first declaration (even when that is, say, a friend declaration).

I would manually look through each redeclaration of `Method`, e.g.

for (auto Redecl : Method->redecls()) {
  if (Redecl->isExplicitlyDefaulted()) {
    if (Redecl->isOutOfLine())
      return defaulted_out_of_class;
    else
      return defaulted_in_class;
  }
}
return not_defaulted;

That worked perfectly, thanks!
--paulr