Skip to content
Commit aa56e66b authored by Roy Jacobson's avatar Roy Jacobson
Browse files

[clang-tidy] Tweak 'rule of 3/5' checks to allow defaulting a destructor outside the class.

A somewhat common code-pattern is to default a destructor in the source file and not in the header.
For example, this is the way to use smart pointers with forward-declared classes:

```c++

struct Impl;
struct A {
  ~A(); // Can't be defaulted in the header.

private:
  std::unique_ptr<Impl> impl;
};
```

To be able to use this check with this pattern, I modified the behavior with `AllowSoleDefaultDtor`
to not trigger on destructors if they aren't defined yet.
Since a declared destructor should still be defined somewhere in the program, this
won't miss bad classes, just diagnose on less translation units.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D143851
parent 664f345c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment