Skip to content

Commit

Permalink
Protect the ArgList dtor
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dwblaikie committed Apr 20, 2014
1 parent f4a2635 commit 1df9ce8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 6 additions & 2 deletions include/llvm/Option/ArgList.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ class ArgList {
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
/// @{
Expand Down
5 changes: 0 additions & 5 deletions lib/Option/ArgList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ void arg_iterator::SkipToNextArg() {
}
}

//

ArgList::ArgList() {
}

ArgList::~ArgList() {
}

Expand Down

0 comments on commit 1df9ce8

Please sign in to comment.