[clang] 736385c - EHScopeStack::Cleanup has virtual functions so the destructor should be too.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 21 21:21:56 PDT 2020


I've reverted this in b5eafda8d3ef02f9f78e090725564dd28e573322 - the
warning isn't accurate/appropriate - this type is safe as it was previously
written (having a protected non-virtual dtor and derived classes being
final with a non-virtual dtor - so there's no way (well, inside the base
class you could, but that's a very limited scope) to polymorphically
destroy this type accidentally/slicing, etc).

On Mon, Mar 2, 2020 at 7:07 AM Simon Pilgrim via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

>
> Author: Simon Pilgrim
> Date: 2020-03-02T15:06:34Z
> New Revision: 736385c0b49d42f398ffa1458883f0d182178ef4
>
> URL:
> https://github.com/llvm/llvm-project/commit/736385c0b49d42f398ffa1458883f0d182178ef4
> DIFF:
> https://github.com/llvm/llvm-project/commit/736385c0b49d42f398ffa1458883f0d182178ef4.diff
>
> LOG: EHScopeStack::Cleanup has virtual functions so the destructor should
> be too.
>
> Fixes cppcheck warning.
>
> Added:
>
>
> Modified:
>     clang/lib/CodeGen/EHScopeStack.h
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/clang/lib/CodeGen/EHScopeStack.h
> b/clang/lib/CodeGen/EHScopeStack.h
> index 0ed67aabcd62..4dd3da3e90e7 100644
> --- a/clang/lib/CodeGen/EHScopeStack.h
> +++ b/clang/lib/CodeGen/EHScopeStack.h
> @@ -148,7 +148,7 @@ class EHScopeStack {
>      virtual void anchor();
>
>    protected:
> -    ~Cleanup() = default;
> +    virtual ~Cleanup() = default;
>
>    public:
>      Cleanup(const Cleanup &) = default;
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200321/9aa1e4b0/attachment.html>


More information about the cfe-commits mailing list