LLVM 24.0.0git
DerivedUser.h
Go to the documentation of this file.
1//===- DerivedUser.h - Base for non-IR Users --------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_IR_DERIVEDUSER_H
10#define LLVM_IR_DERIVEDUSER_H
11
12#include "llvm/IR/User.h"
13
14namespace llvm {
15
16class Type;
17
18/// Extension point for the Value hierarchy. All classes outside of lib/IR
19/// that wish to inherit from User should instead inherit from DerivedUser
20/// instead. Inheriting from this class is discouraged.
21///
22/// Generally speaking, Value is the base of a closed class hierarchy
23/// that can't be extended by code outside of lib/IR. This class creates a
24/// loophole that allows classes outside of lib/IR to extend User to leverage
25/// its use/def list machinery.
26class DerivedUser : public User {
27protected:
28 using DeleteValueTy = void (*)(DerivedUser *);
29
30private:
31 friend class Value;
32
33 DeleteValueTy DeleteValue;
34
35public:
37 DeleteValueTy DeleteValue)
38 : User(Ty, VK, AllocInfo), DeleteValue(DeleteValue) {}
39};
40
41} // end namespace llvm
42
43#endif // LLVM_IR_DERIVEDUSER_H
void(*)(DerivedUser *) DeleteValueTy
Definition DerivedUser.h:28
DerivedUser(Type *Ty, unsigned VK, AllocInfo AllocInfo, DeleteValueTy DeleteValue)
Definition DerivedUser.h:36
friend class Value
Definition DerivedUser.h:31
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
User(Type *ty, unsigned vty, AllocInfo AllocInfo)
Definition User.h:119
This is an optimization pass for GlobalISel generic memory operations.
Information about how a User object was allocated, to be passed into the User constructor.
Definition User.h:79