[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    [cfe-dev] Detecting an out-of-class defaulted method
From:       via cfe-dev <cfe-dev () lists ! llvm ! org>
Date:       2021-08-31 22:16:59
Message-ID: BYAPR13MB2421B732C312B75080D1AF7592CC9 () BYAPR13MB2421 ! namprd13 ! prod ! outlook ! com
[Download RAW message or body]

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

_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic