From 1df9ce8da582a9a945f73829d84689e66689d7e0 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 20 Apr 2014 23:59:00 +0000 Subject: [PATCH] Protect the ArgList dtor 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 | 8 ++++++-- lib/Option/ArgList.cpp | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/llvm/Option/ArgList.h b/include/llvm/Option/ArgList.h index 25248f444dd..ab40a1a0d40 100644 --- a/include/llvm/Option/ArgList.h +++ b/include/llvm/Option/ArgList.h @@ -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 /// @{ diff --git a/lib/Option/ArgList.cpp b/lib/Option/ArgList.cpp index 2d65c5ac870..1f16331e079 100644 --- a/lib/Option/ArgList.cpp +++ b/lib/Option/ArgList.cpp @@ -33,11 +33,6 @@ void arg_iterator::SkipToNextArg() { } } -// - -ArgList::ArgList() { -} - ArgList::~ArgList() { }