1 //===- DerivedUser.h - Base for non-IR Users --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_IR_DERIVEDUSER_H
11 #define LLVM_IR_DERIVEDUSER_H
13 #include "llvm/IR/User.h"
20 /// Extension point for the Value hierarchy. All classes outside of lib/IR
21 /// that wish to inherit from User should instead inherit from DerivedUser
22 /// instead. Inheriting from this class is discouraged.
24 /// Generally speaking, Value is the base of a closed class hierarchy
25 /// that can't be extended by code outside of lib/IR. This class creates a
26 /// loophole that allows classes outside of lib/IR to extend User to leverage
27 /// its use/def list machinery.
28 class DerivedUser : public User {
30 using DeleteValueTy = void (*)(DerivedUser *);
35 DeleteValueTy DeleteValue;
38 DerivedUser(Type *Ty, unsigned VK, Use *U, unsigned NumOps,
39 DeleteValueTy DeleteValue)
40 : User(Ty, VK, U, NumOps), DeleteValue(DeleteValue) {}
43 } // end namespace llvm
45 #endif // LLVM_IR_DERIVEDUSER_H