DeclarationName for C++ destructor

Hi clang,

After read some code relevant to DeclarationName, i have a little
problem about it.

For some C++ destructor(compile generated?), the base class (have some
virtual member) destructor and the derived class destructor have the
same DeclarationName.

Examples:

class base {

  virtual void foo() const {}

};

class child: public base {

  void foo() {}

};

if i use LookupPtr to find declarations in the base class with the
derived class destructor's DeclarationName, i will get the base class
destructor. Is this expected? If so, what does this for?

That doesn’t sound quite right, but in any case, you shouldn’t be using name lookup to find a destructor. Use Sema::LookupDestructor instead.

Sean

Hi Sean,

Thank you for your reply.

I want to do some check to C++ override over all the methoddecls, but
when i try to do this in FindOverridenMethod which use name lookup to
find methoddecls with the same DeclarationName, I got the problem.

According to what you say, maybe i should treat dtor(ctor,
operator...) particularly.