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.parameter;
7 
8 import llvm_hiwrap.types;
9 
10 /** Functions in this group relate to arguments/parameters on functions.
11  *
12  * Functions in this group expect LLVMValueRef instances that correspond
13  * to llvm::Function instances.
14  */
15 struct ParameterValue {
16     import llvm;
17     import llvm_hiwrap.value.function_ : FunctionValue;
18 
19     LxValue value;
20     alias value this;
21 
22     /** Obtain the function to which this argument belongs.
23      *
24      * Unlike other functions in this group, this one takes an LLVMValueRef
25      * that corresponds to a llvm::Attribute.
26      *
27      * The returned LLVMValueRef is the llvm::Function to which this
28      * argument belongs.
29      *
30      * TODO what does it mean by an Attribute? I don't think this will work.
31      */
32     FunctionValue parent() {
33         return LLVMGetParamParent(value).LxValue.LxUserValue.LxFunctionValue.FunctionValue;
34     }
35 
36     /**
37      * Set the alignment for a function parameter.
38      *
39      * @see llvm::Argument::addAttr()
40      * @see llvm::AttrBuilder::addAlignmentAttr()
41      */
42     //void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned Align);
43 }