[llvm] r206727 - Protect the ArgList dtor

Benjamin Kramer benny.kra at gmail.com
Mon Apr 21 01:22:22 PDT 2014


> On 21.04.2014, at 02:07, David Blaikie <dblaikie at gmail.com> wrote:
>
> Author: dblaikie
> Date: Sun Apr 20 18:59:00 2014
> New Revision: 206727
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206727&view=rev
> Log:
> Protect the ArgList dtor
>
> It could even be made non-virtual if it weren't for bad compiler
> warnings.

Do we still support compilers with a broken non-virtual dtor warning?
GCC fixed this in 4.3 or 4.4.

- Ben
>
> This demonstrates that ArgList objects aren't destroyed polymorphically
> and possibly that they aren't even used polymorphically. If that's the
> case, it might be possible to refactor the two ArgList types more
> separately and simplify the Arg ownership model. *continues
> experimenting*
>
> Modified:
>    llvm/trunk/include/llvm/Option/ArgList.h
>    llvm/trunk/lib/Option/ArgList.cpp
>
> Modified: llvm/trunk/include/llvm/Option/ArgList.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/ArgList.h?rev=206727&r1=206726&r2=206727&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Option/ArgList.h (original)
> +++ llvm/trunk/include/llvm/Option/ArgList.h Sun Apr 20 18:59:00 2014
> @@ -106,10 +106,14 @@ private:
>   arglist_type Args;
>
> protected:
> -  ArgList();
> +  // Default ctor provided explicitly as it is not provided implicitly due to
> +  // the presence of the (deleted) copy ctor above.
> +  ArgList() { }
> +  // Virtual to provide a vtable anchor and because -Wnon-virtua-dtor warns, not
> +  // because this type is ever actually destroyed polymorphically.
> +  virtual ~ArgList();
>
> public:
> -  virtual ~ArgList();
>
>   /// @name Arg Access
>   /// @{
>
> Modified: llvm/trunk/lib/Option/ArgList.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/ArgList.cpp?rev=206727&r1=206726&r2=206727&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Option/ArgList.cpp (original)
> +++ llvm/trunk/lib/Option/ArgList.cpp Sun Apr 20 18:59:00 2014
> @@ -33,11 +33,6 @@ void arg_iterator::SkipToNextArg() {
>   }
> }
>
> -//
> -
> -ArgList::ArgList() {
> -}
> -
> ArgList::~ArgList() {
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list