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, LLVMValueRef Function);
59 
60 LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
61     LLVMDIBuilderRef D, unsigned Tag, LLVMMetadataRef Scope, const char *Name,
62     LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty, int AlwaysPreserve,
63     unsigned Flags, unsigned ArgNo);
64 
65 LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef D,
66                                              const char *Name,
67                                              uint64_t SizeInBits,
68                                              uint64_t AlignInBits,
69                                              unsigned Encoding);
70 
71 LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef D,
72                                                LLVMMetadataRef PointeeType,
73                                                uint64_t SizeInBits,
74                                                uint64_t AlignInBits,
75                                                const char *Name);
76 
77 LLVMMetadataRef
78 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef D, LLVMMetadataRef File,
79                                   LLVMMetadataRef ParameterTypes);
80 
81 LLVMMetadataRef LLVMDIBuilderCreateStructType(
82     LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name,
83     LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
84     uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
85     LLVMMetadataRef ElementTypes);
86 
87 LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
88     LLVMDIBuilderRef D, unsigned Tag, const char *Name, LLVMMetadataRef Scope,
89     LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang,
90     uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags);
91 
92 LLVMMetadataRef
93 LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef D, LLVMMetadataRef Scope,
94                               const char *Name, LLVMMetadataRef File,
95                               unsigned Line, uint64_t SizeInBits,
96                               uint64_t AlignInBits, uint64_t OffsetInBits,
97                               unsigned Flags, LLVMMetadataRef Ty);
98 
99 LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef D,
100                                              uint64_t SizeInBits,
101                                              uint64_t AlignInBits,
102                                              LLVMMetadataRef ElementType,
103                                              LLVMMetadataRef Subscripts);
104 
105 LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef D,
106                                            LLVMMetadataRef Ty, const char *Name,
107                                            LLVMMetadataRef File, unsigned Line,
108                                            LLVMMetadataRef Context);
109 
110 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef D, int64_t Lo,
111                                                  int64_t Count);
112 
113 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef D,
114                                               LLVMMetadataRef *Data,
115                                               size_t Length);
116 
117 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef D,
118                                                   LLVMMetadataRef *Data,
119                                                   size_t Length);
120 
121 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
122                                               int64_t *Addr, size_t Length);
123 
124 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef D,
125                                              LLVMValueRef Storage,
126                                              LLVMMetadataRef VarInfo,
127                                              LLVMMetadataRef Expr,
128                                              LLVMBasicBlockRef Block);
129 
130 LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D, LLVMValueRef Val,
131                                            uint64_t Offset,
132                                            LLVMMetadataRef VarInfo,
133                                            LLVMMetadataRef Expr,
134                                            LLVMBasicBlockRef Block);
135 
136 #ifdef __cplusplus
137 } // extern "C"
138 #endif
139 
140 #endif
141