Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:59

0001 //===- DerivedUser.h - Base for non-IR Users --------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_IR_DERIVEDUSER_H
0010 #define LLVM_IR_DERIVEDUSER_H
0011 
0012 #include "llvm/IR/User.h"
0013 
0014 namespace llvm {
0015 
0016 class Type;
0017 class Use;
0018 
0019 /// Extension point for the Value hierarchy. All classes outside of lib/IR
0020 /// that wish to inherit from User should instead inherit from DerivedUser
0021 /// instead. Inheriting from this class is discouraged.
0022 ///
0023 /// Generally speaking, Value is the base of a closed class hierarchy
0024 /// that can't be extended by code outside of lib/IR. This class creates a
0025 /// loophole that allows classes outside of lib/IR to extend User to leverage
0026 /// its use/def list machinery.
0027 class DerivedUser : public User {
0028 protected:
0029   using  DeleteValueTy = void (*)(DerivedUser *);
0030 
0031 private:
0032   friend class Value;
0033 
0034   DeleteValueTy DeleteValue;
0035 
0036 public:
0037   DerivedUser(Type *Ty, unsigned VK, AllocInfo AllocInfo,
0038               DeleteValueTy DeleteValue)
0039       : User(Ty, VK, AllocInfo), DeleteValue(DeleteValue) {}
0040 };
0041 
0042 } // end namespace llvm
0043 
0044 #endif // LLVM_IR_DERIVEDUSER_H