aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/IR/Instruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/Instruction.h')
-rw-r--r--include/llvm/IR/Instruction.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/llvm/IR/Instruction.h b/include/llvm/IR/Instruction.h
index fca29900f4c29..6e109735ddd36 100644
--- a/include/llvm/IR/Instruction.h
+++ b/include/llvm/IR/Instruction.h
@@ -36,6 +36,10 @@ class FastMathFlags;
class MDNode;
struct AAMDNodes;
+template <> struct ilist_alloc_traits<Instruction> {
+ static inline void deleteNode(Instruction *V);
+};
+
class Instruction : public User,
public ilist_node_with_parent<Instruction, BasicBlock> {
BasicBlock *Parent;
@@ -47,13 +51,13 @@ class Instruction : public User,
HasMetadataBit = 1 << 15
};
+protected:
+ ~Instruction(); // Use deleteValue() to delete a generic Instruction.
+
public:
Instruction(const Instruction &) = delete;
Instruction &operator=(const Instruction &) = delete;
- // Out of line virtual method, so the vtable, etc has a home.
- ~Instruction() override;
-
/// Specialize the methods defined in Value, as we know that an instruction
/// can only be used by other instructions.
Instruction *user_back() { return cast<Instruction>(*user_begin());}
@@ -640,6 +644,10 @@ private:
Instruction *cloneImpl() const;
};
+inline void ilist_alloc_traits<Instruction>::deleteNode(Instruction *V) {
+ V->deleteValue();
+}
+
} // end namespace llvm
#endif // LLVM_IR_INSTRUCTION_H