mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 16:25:18 +00:00
Recommit r231221: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"
Reverted in r231254 due to a self-hosting crash of Clang (see Clang PR22793). Workaround the crash by using {} instead of = default to define a dtor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231274 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -714,7 +714,6 @@ class basic_parser_impl { // non-template implementation of basic_parser<t>
|
|||||||
public:
|
public:
|
||||||
basic_parser_impl(Option &O) {}
|
basic_parser_impl(Option &O) {}
|
||||||
|
|
||||||
virtual ~basic_parser_impl() {}
|
|
||||||
|
|
||||||
enum ValueExpected getValueExpectedFlagDefault() const {
|
enum ValueExpected getValueExpectedFlagDefault() const {
|
||||||
return ValueRequired;
|
return ValueRequired;
|
||||||
@@ -743,6 +742,7 @@ public:
|
|||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
~basic_parser_impl() = default;
|
||||||
// A helper for basic_parser::printOptionDiff.
|
// A helper for basic_parser::printOptionDiff.
|
||||||
void printOptionName(const Option &O, size_t GlobalWidth) const;
|
void printOptionName(const Option &O, size_t GlobalWidth) const;
|
||||||
};
|
};
|
||||||
@@ -755,12 +755,16 @@ public:
|
|||||||
basic_parser(Option &O) : basic_parser_impl(O) {}
|
basic_parser(Option &O) : basic_parser_impl(O) {}
|
||||||
typedef DataType parser_data_type;
|
typedef DataType parser_data_type;
|
||||||
typedef OptionValue<DataType> OptVal;
|
typedef OptionValue<DataType> OptVal;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Workaround Clang PR22793
|
||||||
|
~basic_parser() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<bool>
|
// parser<bool>
|
||||||
//
|
//
|
||||||
template <> class parser<bool> : public basic_parser<bool> {
|
template <> class parser<bool> final : public basic_parser<bool> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -787,7 +791,8 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<bool>);
|
|||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<boolOrDefault>
|
// parser<boolOrDefault>
|
||||||
template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
|
template <>
|
||||||
|
class parser<boolOrDefault> final : public basic_parser<boolOrDefault> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -813,7 +818,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<boolOrDefault>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<int>
|
// parser<int>
|
||||||
//
|
//
|
||||||
template <> class parser<int> : public basic_parser<int> {
|
template <> class parser<int> final : public basic_parser<int> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -835,7 +840,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<int>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<unsigned>
|
// parser<unsigned>
|
||||||
//
|
//
|
||||||
template <> class parser<unsigned> : public basic_parser<unsigned> {
|
template <> class parser<unsigned> final : public basic_parser<unsigned> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -858,7 +863,8 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned>);
|
|||||||
// parser<unsigned long long>
|
// parser<unsigned long long>
|
||||||
//
|
//
|
||||||
template <>
|
template <>
|
||||||
class parser<unsigned long long> : public basic_parser<unsigned long long> {
|
class parser<unsigned long long> final
|
||||||
|
: public basic_parser<unsigned long long> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -881,7 +887,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned long long>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<double>
|
// parser<double>
|
||||||
//
|
//
|
||||||
template <> class parser<double> : public basic_parser<double> {
|
template <> class parser<double> final : public basic_parser<double> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -903,7 +909,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<double>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<float>
|
// parser<float>
|
||||||
//
|
//
|
||||||
template <> class parser<float> : public basic_parser<float> {
|
template <> class parser<float> final : public basic_parser<float> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -925,7 +931,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<float>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<std::string>
|
// parser<std::string>
|
||||||
//
|
//
|
||||||
template <> class parser<std::string> : public basic_parser<std::string> {
|
template <> class parser<std::string> final : public basic_parser<std::string> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
@@ -950,7 +956,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<std::string>);
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// parser<char>
|
// parser<char>
|
||||||
//
|
//
|
||||||
template <> class parser<char> : public basic_parser<char> {
|
template <> class parser<char> final : public basic_parser<char> {
|
||||||
public:
|
public:
|
||||||
parser(Option &O) : basic_parser(O) {}
|
parser(Option &O) : basic_parser(O) {}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user