1 //===- DIBuilderBindings.h - Bindings for DIBuilder -------------*- 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 // This file defines C bindings for the DIBuilder class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_BINDINGS_GO_LLVM_DIBUILDERBINDINGS_H
15 #define LLVM_BINDINGS_GO_LLVM_DIBUILDERBINDINGS_H
16 
17 #include "IRBindings.h"
18 #include "llvm-c/Core.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // FIXME: These bindings shouldn't be Go-specific and should eventually move to
25 // a (somewhat) less stable collection of C APIs for use in creating bindings of
26 // LLVM in other languages.
27 
28 typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
29 
30 LLVMDIBuilderRef LLVMNewDIBuilder(LLVMModuleRef m);
31 
32 void LLVMDIBuilderDestroy(LLVMDIBuilderRef d);
33 void LLVMDIBuilderFinalize(LLVMDIBuilderRef d);
34 
35 LLVMMetadataRef
36 LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef D, unsigned Language,
37                                const char *File, const char *Dir,
38                                const char *Producer, int Optimized,
39                                const char *Flags, unsigned RuntimeVersion);
40 
41 LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef D, const char *File,
42                                         const char *Dir);
43 
44 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef D,
45                                                 LLVMMetadataRef Scope,
46                                                 LLVMMetadataRef File,
47                                                 unsigned Line, unsigned Column);
48 
49 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef D,
50                                                     LLVMMetadataRef Scope,
51                                                     LLVMMetadataRef File,
52                                                     unsigned Discriminator);
53 
54 LLVMMetadataRef LLVMDIBuilderCreateFunction(
55     LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name,
56     const char *LinkageName, LLVMMetadataRef File, unsigned Line,
57     LLVMMetadataRef CompositeType, int IsLocalToUnit, int IsDefinition,
58     unsigned ScopeLine, unsigned Flags, int IsOptimized);
59 
60 LLVMMetadataRef
61 LLVMDIBuilderCreateAutoVariable(LLVMDIBuilderRef D, LLVMMetadataRef Scope,
62                                 const char *Name, LLVMMetadataRef File,
63                                 unsigned Line, LLVMMetadataRef Ty,
64                                 int AlwaysPreserve, unsigned Flags);
65 
66 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
67     LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name, unsigned ArgNo,
68     LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty, int AlwaysPreserve,
69     unsigned Flags);
70 
71 LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef D,
72                                              const char *Name,
73                                              uint64_t SizeInBits,
74                                              uint64_t AlignInBits,
75                                              unsigned Encoding);
76 
77 LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef D,
78                                                LLVMMetadataRef PointeeType,
79                                                uint64_t SizeInBits,
80                                                uint64_t AlignInBits,
81                                                const char *Name);
82 
83 LLVMMetadataRef
84 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef D, LLVMMetadataRef File,
85                                   LLVMMetadataRef ParameterTypes);
86 
87 LLVMMetadataRef LLVMDIBuilderCreateStructType(
88     LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name,
89     LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
90     uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
91     LLVMMetadataRef ElementTypes);
92 
93 LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
94     LLVMDIBuilderRef D, unsigned Tag, const char *Name, LLVMMetadataRef Scope,
95     LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang,
96     uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags);
97 
98 LLVMMetadataRef
99 LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef D, LLVMMetadataRef Scope,
100                               const char *Name, LLVMMetadataRef File,
101                               unsigned Line, uint64_t SizeInBits,
102                               uint64_t AlignInBits, uint64_t OffsetInBits,
103                               unsigned Flags, LLVMMetadataRef Ty);
104 
105 LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef D,
106                                              uint64_t SizeInBits,
107                                              uint64_t AlignInBits,
108                                              LLVMMetadataRef ElementType,
109                                              LLVMMetadataRef Subscripts);
110 
111 LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef D,
112                                            LLVMMetadataRef Ty, const char *Name,
113                                            LLVMMetadataRef File, unsigned Line,
114                                            LLVMMetadataRef Context);
115 
116 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef D, int64_t Lo,
117                                                  int64_t Count);
118 
119 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef D,
120                                               LLVMMetadataRef *Data,
121                                               size_t Length);
122 
123 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef D,
124                                                   LLVMMetadataRef *Data,
125                                                   size_t Length);
126 
127 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
128                                               int64_t *Addr, size_t Length);
129 
130 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef D,
131                                              LLVMValueRef Storage,
132                                              LLVMMetadataRef VarInfo,
133                                              LLVMMetadataRef Expr,
134                                              LLVMBasicBlockRef Block);
135 
136 LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D, LLVMValueRef Val,
137                                            uint64_t Offset,
138                                            LLVMMetadataRef VarInfo,
139                                            LLVMMetadataRef Expr,
140                                            LLVMBasicBlockRef Block);
141 
142 #ifdef __cplusplus
143 } // extern "C"
144 #endif
145 
146 #endif
147