File tree Expand file tree Collapse file tree 3 files changed +28
-23
lines changed Expand file tree Collapse file tree 3 files changed +28
-23
lines changed Original file line number Diff line number Diff line change @@ -788,11 +788,11 @@ bool shouldAllocateFileSpace(ArrayRef<ProgramHeader> Phdrs,
788788// /
789789// / Derivered classes should not modify OptClassID to ensue that
790790// / dyn_cast<ELFYAML::Opt> can find this interface.
791- class Opt : public yaml ::Opt {
791+ class Opt : public yaml ::IO::OptBase {
792792public:
793793 Opt () {
794+ OptBaseClassID = &ID;
794795 OptClassID = &ID;
795- ELFOptClassID = &ID;
796796 }
797797 ~Opt ();
798798
@@ -811,13 +811,15 @@ class Opt : public yaml::Opt {
811811 virtual void postMapping (const ELFYAML::Object &Object,
812812 bool IsOutputting) = 0;
813813
814- // / Tell IO::Opt to be this and derivered classes.
815- static bool classof (const yaml::Opt *Obj) { return (Obj->OptClassID == &ID); }
814+ // / Tell IO::OptBase to be this and derivered classes.
815+ static bool classof (const yaml::IO::OptBase *Obj) {
816+ return (Obj->OptBaseClassID == &ID);
817+ }
816818
817819 // / This will be not needed unless the pointer to ELFYAML::Opt would
818820 // / be cast further.
819- static bool classof (const Opt *Obj) { return (Obj->ELFOptClassID == &ID); }
820- const char *ELFOptClassID ;
821+ static bool classof (const Opt *Obj) { return (Obj->OptClassID == &ID); }
822+ const char *OptClassID ;
821823
822824private:
823825 static const char ID;
Original file line number Diff line number Diff line change @@ -39,18 +39,6 @@ class VersionTuple;
3939
4040namespace yaml {
4141
42- // / The base class of options.
43- class Opt {
44- public:
45- virtual ~Opt ();
46-
47- static bool classof (const Opt *Obj) { return (Obj->OptClassID == &ID); }
48- const char *OptClassID = &ID;
49-
50- private:
51- static const char ID;
52- };
53-
5442enum class NodeKind : uint8_t {
5543 Scalar,
5644 Map,
@@ -974,13 +962,28 @@ class IO {
974962 }
975963 }
976964
965+ public:
966+ // / The base class of options.
967+ class OptBase {
968+ public:
969+ virtual ~OptBase ();
970+
971+ static bool classof (const OptBase *Obj) {
972+ return (Obj->OptBaseClassID == &ID);
973+ }
974+ const char *OptBaseClassID = &ID;
975+
976+ private:
977+ static const char ID;
978+ };
979+
977980private:
978981 void *Ctxt;
979- Opt DefaultOpt;
982+ OptBase DefaultOpt;
980983
981984public:
982985 // / This may be overwritten in derivered classes.
983- Opt *Opt = &DefaultOpt;
986+ OptBase *Opt = &DefaultOpt;
984987};
985988
986989namespace detail {
Original file line number Diff line number Diff line change @@ -32,12 +32,12 @@ using namespace llvm;
3232using namespace yaml ;
3333
3434// ===----------------------------------------------------------------------===//
35- // Opt
35+ // IO::OptBase
3636// ===----------------------------------------------------------------------===//
3737
38- Opt::~Opt () = default ;
38+ IO::OptBase::~OptBase () = default ;
3939
40- const char Opt ::ID = ' @' ;
40+ const char IO::OptBase ::ID = ' @' ;
4141
4242// ===----------------------------------------------------------------------===//
4343// IO
You can’t perform that action at this time.
0 commit comments