llvm.org GIT mirror llvm / 798a8cd
Use StringRef instead of raw pointer in MachinePassRegistry (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283006 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 4 years ago
1 changed file(s) with 14 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
3636 public:
3737 MachinePassRegistryListener() {}
3838 virtual ~MachinePassRegistryListener() {}
39 virtual void NotifyAdd(const char *N, MachinePassCtor C, const char *D) = 0;
40 virtual void NotifyRemove(const char *N) = 0;
39 virtual void NotifyAdd(StringRef N, MachinePassCtor C, StringRef D) = 0;
40 virtual void NotifyRemove(StringRef N) = 0;
4141 };
4242
4343
5151 private:
5252
5353 MachinePassRegistryNode *Next; // Next function pass in list.
54 const char *Name; // Name of function pass.
55 const char *Description; // Description string.
54 StringRef Name; // Name of function pass.
55 StringRef Description; // Description string.
5656 MachinePassCtor Ctor; // Function pass creator.
5757
5858 public:
6767 // Accessors
6868 MachinePassRegistryNode *getNext() const { return Next; }
6969 MachinePassRegistryNode **getNextAddress() { return &Next; }
70 const char *getName() const { return Name; }
71 const char *getDescription() const { return Description; }
70 StringRef getName() const { return Name; }
71 StringRef getDescription() const { return Description; }
7272 MachinePassCtor getCtor() const { return Ctor; }
7373 void setNext(MachinePassRegistryNode *N) { Next = N; }
7474
131131 // Add existing passes to option.
132132 for (RegistryClass *Node = RegistryClass::getList();
133133 Node; Node = Node->getNext()) {
134 this->addLiteralOption(Node->getName(),
134 this->addLiteralOption(Node->getName().data(),
135135 (typename RegistryClass::FunctionPassCtor)Node->getCtor(),
136 Node->getDescription());
136 Node->getDescription().data());
137137 }
138138
139139 // Make sure we listen for list changes.
142142
143143 // Implement the MachinePassRegistryListener callbacks.
144144 //
145 void NotifyAdd(const char *N, MachinePassCtor C, const char *D) override {
146 this->addLiteralOption(N, (typename RegistryClass::FunctionPassCtor)C, D);
145 void NotifyAdd(StringRef N, MachinePassCtor C, StringRef D) override {
146 this->addLiteralOption(N.data(),
147 (typename RegistryClass::FunctionPassCtor)C,
148 D.data());
147149 }
148 void NotifyRemove(const char *N) override {
149 this->removeLiteralOption(N);
150 void NotifyRemove(StringRef N) override {
151 this->removeLiteralOption(N.data());
150152 }
151153 };
152154