[llvm] r359902 - [llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"
Don Hinton via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 09:15:13 PDT 2019
Author: dhinton
Date: Fri May 3 09:15:13 2019
New Revision: 359902
URL: http://llvm.org/viewvc/llvm-project?rev=359902&view=rev
Log:
[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"
Summary: This patch was previously applied in r231221, and reverted in
r231254 because it broke self-hosting. It was subsequently fixed and
reapplied in r231274. Unfortunately, making the `parser<T>` classes
final prevents inheritance which makes it impossible to implement
custom parsers.
Reverting r231221 restores the ability to customize parsers.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: craig.topper, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60955
Modified:
llvm/trunk/include/llvm/Support/CommandLine.h
Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=359902&r1=359901&r2=359902&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Fri May 3 09:15:13 2019
@@ -827,6 +827,8 @@ class basic_parser_impl { // non-templat
public:
basic_parser_impl(Option &) {}
+ virtual ~basic_parser_impl() {}
+
enum ValueExpected getValueExpectedFlagDefault() const {
return ValueRequired;
}
@@ -854,8 +856,6 @@ public:
virtual void anchor();
protected:
- ~basic_parser_impl() = default;
-
// A helper for basic_parser::printOptionDiff.
void printOptionName(const Option &O, size_t GlobalWidth) const;
};
@@ -869,15 +869,12 @@ public:
using OptVal = OptionValue<DataType>;
basic_parser(Option &O) : basic_parser_impl(O) {}
-
-protected:
- ~basic_parser() = default;
};
//--------------------------------------------------
// parser<bool>
//
-template <> class parser<bool> final : public basic_parser<bool> {
+template <> class parser<bool> : public basic_parser<bool> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -904,8 +901,7 @@ extern template class basic_parser<bool>
//--------------------------------------------------
// parser<boolOrDefault>
-template <>
-class parser<boolOrDefault> final : public basic_parser<boolOrDefault> {
+template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -931,7 +927,7 @@ extern template class basic_parser<boolO
//--------------------------------------------------
// parser<int>
//
-template <> class parser<int> final : public basic_parser<int> {
+template <> class parser<int> : public basic_parser<int> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -953,7 +949,7 @@ extern template class basic_parser<int>;
//--------------------------------------------------
// parser<unsigned>
//
-template <> class parser<unsigned> final : public basic_parser<unsigned> {
+template <> class parser<unsigned> : public basic_parser<unsigned> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -999,8 +995,7 @@ extern template class basic_parser<unsig
// parser<unsigned long long>
//
template <>
-class parser<unsigned long long> final
- : public basic_parser<unsigned long long> {
+class parser<unsigned long long> : public basic_parser<unsigned long long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1023,7 +1018,7 @@ extern template class basic_parser<unsig
//--------------------------------------------------
// parser<double>
//
-template <> class parser<double> final : public basic_parser<double> {
+template <> class parser<double> : public basic_parser<double> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1045,7 +1040,7 @@ extern template class basic_parser<doubl
//--------------------------------------------------
// parser<float>
//
-template <> class parser<float> final : public basic_parser<float> {
+template <> class parser<float> : public basic_parser<float> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1067,7 +1062,7 @@ extern template class basic_parser<float
//--------------------------------------------------
// parser<std::string>
//
-template <> class parser<std::string> final : public basic_parser<std::string> {
+template <> class parser<std::string> : public basic_parser<std::string> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1092,7 +1087,7 @@ extern template class basic_parser<std::
//--------------------------------------------------
// parser<char>
//
-template <> class parser<char> final : public basic_parser<char> {
+template <> class parser<char> : public basic_parser<char> {
public:
parser(Option &O) : basic_parser(O) {}
More information about the llvm-commits
mailing list