[llvm] 588ffda - [polly] Fix compiler warning. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 08:13:11 PDT 2022


Derived classes such as `ScopViewer` are instantiated as passes. i.e.
the base class is `PassInfoMixin` but it uses CRTP hence cannot be
used as a runtime-polymorphic type. DOTGraphTraitsViewer is also used
as a mixin, i.e. we wouldn't really need the public inheritance of
those classes. I will commit that change.

DOTGraphTraitsViewer and DOTGraphTraitsPrinter cannot be marked as
final because it is derived from. Marking ScopViewer etc does not
silence the warning.

Michael

Am Mo., 16. Mai 2022 um 17:50 Uhr schrieb David Blaikie <dblaikie at gmail.com>:
>
> is the virtual dtor used/needed? (are instances of this class ever
> destroyed polymorphically)
>
> If not, this type could be marked `final` and leaving the dtor non-virtual.
>
> On Mon, May 9, 2022 at 12:06 PM Michael Kruse via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> >
> > Author: Michael Kruse
> > Date: 2022-05-09T14:04:40-05:00
> > New Revision: 588ffdaf376a191ddcf106c29462f156fa8bdce5
> >
> > URL: https://github.com/llvm/llvm-project/commit/588ffdaf376a191ddcf106c29462f156fa8bdce5
> > DIFF: https://github.com/llvm/llvm-project/commit/588ffdaf376a191ddcf106c29462f156fa8bdce5.diff
> >
> > LOG: [polly] Fix compiler warning. NFC.
> >
> > Fix the warning
> >
> >    warning: 'polly::ScopViewer' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]
> >
> > and for several other classes by inserting virtual destructors.
> >
> > Added:
> >
> >
> > Modified:
> >     llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
> >
> > Removed:
> >
> >
> >
> > ################################################################################
> > diff  --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
> > index dac2b2233ff7..24b8813e9b73 100644
> > --- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
> > +++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
> > @@ -44,6 +44,7 @@ struct DOTGraphTraitsViewer
> >      : public PassInfoMixin<DOTGraphTraitsViewer<AnalysisT, IsSimple, GraphT,
> >                                                  AnalysisGraphTraitsT>> {
> >    DOTGraphTraitsViewer(StringRef GraphName) : Name(GraphName) {}
> > +  virtual ~DOTGraphTraitsViewer() {}
> >
> >    /// Return true if this function should be processed.
> >    ///
> > @@ -98,6 +99,7 @@ struct DOTGraphTraitsPrinter
> >      : public PassInfoMixin<DOTGraphTraitsPrinter<AnalysisT, IsSimple, GraphT,
> >                                                   AnalysisGraphTraitsT>> {
> >    DOTGraphTraitsPrinter(StringRef GraphName) : Name(GraphName) {}
> > +  virtual ~DOTGraphTraitsPrinter() {}
> >
> >    /// Return true if this function should be processed.
> >    ///
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



--
Tardyzentrismus verboten!


More information about the llvm-commits mailing list