LLVM  8.0.1
DerivedUser.h
Go to the documentation of this file.
1 //===- DerivedUser.h - Base for non-IR Users --------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_IR_DERIVEDUSER_H
11 #define LLVM_IR_DERIVEDUSER_H
12 
13 #include "llvm/IR/User.h"
14 
15 namespace llvm {
16 
17 class Type;
18 class Use;
19 
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.
23 ///
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 {
29 protected:
30  using DeleteValueTy = void (*)(DerivedUser *);
31 
32 private:
33  friend class Value;
34 
35  DeleteValueTy DeleteValue;
36 
37 public:
38  DerivedUser(Type *Ty, unsigned VK, Use *U, unsigned NumOps,
39  DeleteValueTy DeleteValue)
40  : User(Ty, VK, U, NumOps), DeleteValue(DeleteValue) {}
41 };
42 
43 } // end namespace llvm
44 
45 #endif // LLVM_IR_DERIVEDUSER_H
DerivedUser(Type *Ty, unsigned VK, Use *U, unsigned NumOps, DeleteValueTy DeleteValue)
Definition: DerivedUser.h:38
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition: MsgPackReader.h:49
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Extension point for the Value hierarchy.
Definition: DerivedUser.h:28
void(*)(DerivedUser *) DeleteValueTy
Definition: DerivedUser.h:30
A Use represents the edge between a Value definition and its users.
Definition: Use.h:56
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
LLVM Value Representation.
Definition: Value.h:73