1 /**
2 Copyright: Copyright (c) 2017, Joakim Brännström. All rights reserved.
3 License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 */
6 module llvm_hiwrap.value.use;
7 
8 import llvm_hiwrap.types;
9 import llvm_hiwrap.value.user;
10 
11 /** This module defines functions that allow you to inspect the uses of a
12  * LLVMValueRef.
13  *
14  * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance. Each
15  * LLVMUseRef (which corresponds to a llvm::Use instance) holds a llvm::User
16  * and llvm::Value.
17  */
18 struct UseValue {
19     import llvm;
20     import llvm_hiwrap.value.user;
21     import llvm_hiwrap.value.value;
22 
23     LxUseValue value;
24     alias value this;
25 
26     /** Obtain the user value for a user.
27      *
28      * The returned value corresponds to a llvm::User type.
29      *
30      * @see llvm::Use::getUser()
31      */
32     UserValue user() {
33         return LLVMGetUser(this).LxValue.LxUserValue.UserValue;
34     }
35 
36     /** Obtain the value this use corresponds to.
37      *
38      * @see llvm::Use::get().
39      */
40     Value usedValue() {
41         return LLVMGetUsedValue(this).LxValue.Value;
42     }
43 }