Protect the ArgList dtor
authorDavid Blaikie <dblaikie@gmail.com>
Sun, 20 Apr 2014 23:59:00 +0000 (23:59 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 20 Apr 2014 23:59:00 +0000 (23:59 +0000)
It could even be made non-virtual if it weren't for bad compiler
warnings.

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*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206727 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Option/ArgList.h
lib/Option/ArgList.cpp

index 25248f444ddedacb834498e17367e0c29603197c..ab40a1a0d40a61d5fbc2ff00101da2780ced9979 100644 (file)
@@ -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
   /// @{
index 2d65c5ac870ad1ee649d40f634d0aee2d14a2606..1f16331e0798669cf06b98972afc39cbd7d653b0 100644 (file)
@@ -33,11 +33,6 @@ void arg_iterator::SkipToNextArg() {
   }
 }
 
-//
-
-ArgList::ArgList() {
-}
-
 ArgList::~ArgList() {
 }