diff options
| author | Serge Guelton <sguelton@quarkslab.com> | 2018-11-09 17:19:45 +0000 |
|---|---|---|
| committer | Serge Guelton <sguelton@quarkslab.com> | 2018-11-09 17:19:45 +0000 |
| commit | 86f8b70f1b7c3f92266197d580f6d86414650997 (patch) | |
| tree | 64e0ce36a5039e01903fc8f147ffc1a3170e9cf7 /llvm/lib/CodeGen/MachinePassRegistry.cpp | |
| parent | c44c174246280dc7614b6591f48010858f482eb9 (diff) | |
| download | bcm5719-llvm-86f8b70f1b7c3f92266197d580f6d86414650997.tar.gz bcm5719-llvm-86f8b70f1b7c3f92266197d580f6d86414650997.zip | |
Type safe version of MachinePassRegistry
Previous version used type erasure through a `void* (*)()` pointer,
which triggered gcc warning and implied a lot of reinterpret_cast.
This version should make it harder to hit ourselves in the foot.
Differential revision: https://reviews.llvm.org/D54203
llvm-svn: 346522
Diffstat (limited to 'llvm/lib/CodeGen/MachinePassRegistry.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachinePassRegistry.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/llvm/lib/CodeGen/MachinePassRegistry.cpp b/llvm/lib/CodeGen/MachinePassRegistry.cpp index 3ee3e40b27e..82daf80a875 100644 --- a/llvm/lib/CodeGen/MachinePassRegistry.cpp +++ b/llvm/lib/CodeGen/MachinePassRegistry.cpp @@ -15,41 +15,3 @@ #include "llvm/CodeGen/MachinePassRegistry.h" using namespace llvm; - -void MachinePassRegistryListener::anchor() { } - -/// setDefault - Set the default constructor by name. -void MachinePassRegistry::setDefault(StringRef Name) { - MachinePassCtor Ctor = nullptr; - for(MachinePassRegistryNode *R = getList(); R; R = R->getNext()) { - if (R->getName() == Name) { - Ctor = R->getCtor(); - break; - } - } - assert(Ctor && "Unregistered pass name"); - setDefault(Ctor); -} - -/// Add - Adds a function pass to the registration list. -/// -void MachinePassRegistry::Add(MachinePassRegistryNode *Node) { - Node->setNext(List); - List = Node; - if (Listener) Listener->NotifyAdd(Node->getName(), - Node->getCtor(), - Node->getDescription()); -} - - -/// Remove - Removes a function pass from the registration list. -/// -void MachinePassRegistry::Remove(MachinePassRegistryNode *Node) { - for (MachinePassRegistryNode **I = &List; *I; I = (*I)->getNextAddress()) { - if (*I == Node) { - if (Listener) Listener->NotifyRemove(Node->getName()); - *I = (*I)->getNext(); - break; - } - } -} |

