@designliquido/llvm-bindings 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +10 -0
  3. package/.github/dependabot.yml +12 -0
  4. package/.github/workflows/build.yml +156 -0
  5. package/.release-it.json +11 -0
  6. package/CHANGELOG.md +2 -0
  7. package/CMakeLists.txt +40 -0
  8. package/CODE_OF_CONDUCT.md +128 -0
  9. package/CONTRIBUTING.md +13 -0
  10. package/LICENSE +21 -0
  11. package/README.md +136 -0
  12. package/cmake/CMakeJS.cmake +57 -0
  13. package/cmake/LLVM.cmake +18 -0
  14. package/dist/index.js +4 -0
  15. package/include/ADT/APFloat.h +22 -0
  16. package/include/ADT/APInt.h +22 -0
  17. package/include/ADT/index.h +7 -0
  18. package/include/BinaryFormat/Dwarf.h +8 -0
  19. package/include/BinaryFormat/index.h +6 -0
  20. package/include/Bitcode/BitcodeWriter.h +6 -0
  21. package/include/Bitcode/index.h +6 -0
  22. package/include/Config/index.h +6 -0
  23. package/include/Config/llvm-config.h +6 -0
  24. package/include/IR/Argument.h +32 -0
  25. package/include/IR/Attributes.h +26 -0
  26. package/include/IR/BasicBlock.h +46 -0
  27. package/include/IR/Constant.h +36 -0
  28. package/include/IR/Constants.h +200 -0
  29. package/include/IR/DIBuilder.h +54 -0
  30. package/include/IR/DataLayout.h +28 -0
  31. package/include/IR/DebugInfoMetadata.h +408 -0
  32. package/include/IR/DebugLoc.h +24 -0
  33. package/include/IR/DerivedTypes.h +232 -0
  34. package/include/IR/Function.h +72 -0
  35. package/include/IR/GlobalObject.h +28 -0
  36. package/include/IR/GlobalValue.h +28 -0
  37. package/include/IR/GlobalVariable.h +36 -0
  38. package/include/IR/IRBuilder.h +280 -0
  39. package/include/IR/Instruction.h +36 -0
  40. package/include/IR/Instructions.h +1150 -0
  41. package/include/IR/Intrinsic.h +8 -0
  42. package/include/IR/LLVMContext.h +22 -0
  43. package/include/IR/Metadata.h +48 -0
  44. package/include/IR/Module.h +56 -0
  45. package/include/IR/Type.h +45 -0
  46. package/include/IR/User.h +32 -0
  47. package/include/IR/Value.h +40 -0
  48. package/include/IR/Verifier.h +8 -0
  49. package/include/IR/index.h +30 -0
  50. package/include/IRReader/IRReader.h +6 -0
  51. package/include/IRReader/index.h +6 -0
  52. package/include/Linker/Linker.h +20 -0
  53. package/include/Linker/index.h +6 -0
  54. package/include/MC/TargetRegistry.h +26 -0
  55. package/include/MC/index.h +6 -0
  56. package/include/Support/SourceMgr.h +22 -0
  57. package/include/Support/TargetSelect.h +6 -0
  58. package/include/Support/index.h +7 -0
  59. package/include/Target/TargetMachine.h +22 -0
  60. package/include/Target/index.h +6 -0
  61. package/include/Util/Array.h +39 -0
  62. package/include/Util/ErrMsg.h +586 -0
  63. package/include/Util/Inherit.h +5 -0
  64. package/include/Util/index.h +5 -0
  65. package/index.ts +5 -0
  66. package/llvm-bindings.d.ts +2233 -0
  67. package/package.json +72 -0
  68. package/src/ADT/APFloat.cpp +31 -0
  69. package/src/ADT/APInt.cpp +37 -0
  70. package/src/ADT/index.cpp +6 -0
  71. package/src/BinaryFormat/Dwarf.cpp +76 -0
  72. package/src/BinaryFormat/index.cpp +5 -0
  73. package/src/Bitcode/BitcodeWriter.cpp +27 -0
  74. package/src/Bitcode/index.cpp +5 -0
  75. package/src/Config/index.cpp +5 -0
  76. package/src/Config/llvm-config.cpp +19 -0
  77. package/src/IR/Argument.cpp +92 -0
  78. package/src/IR/Attributes.cpp +174 -0
  79. package/src/IR/BasicBlock.cpp +151 -0
  80. package/src/IR/Constants.cpp +686 -0
  81. package/src/IR/DIBuilder.cpp +328 -0
  82. package/src/IR/DataLayout.cpp +59 -0
  83. package/src/IR/DebugInfoMetadata.cpp +961 -0
  84. package/src/IR/DebugLoc.cpp +44 -0
  85. package/src/IR/DerivedTypes.cpp +652 -0
  86. package/src/IR/Function.cpp +279 -0
  87. package/src/IR/GlobalObject.cpp +59 -0
  88. package/src/IR/GlobalValue.cpp +75 -0
  89. package/src/IR/GlobalVariable.cpp +122 -0
  90. package/src/IR/IRBuilder.cpp +843 -0
  91. package/src/IR/Instruction.cpp +190 -0
  92. package/src/IR/Instructions.cpp +2866 -0
  93. package/src/IR/Intrinsic.cpp +352 -0
  94. package/src/IR/LLVMContext.cpp +30 -0
  95. package/src/IR/Metadata.cpp +107 -0
  96. package/src/IR/Module.cpp +228 -0
  97. package/src/IR/Type.cpp +278 -0
  98. package/src/IR/User.cpp +81 -0
  99. package/src/IR/Value.cpp +103 -0
  100. package/src/IR/Verifier.cpp +28 -0
  101. package/src/IR/index.cpp +108 -0
  102. package/src/IRReader/IRReader.cpp +19 -0
  103. package/src/IRReader/index.cpp +5 -0
  104. package/src/Linker/Linker.cpp +45 -0
  105. package/src/Linker/index.cpp +5 -0
  106. package/src/MC/TargetRegistry.cpp +88 -0
  107. package/src/MC/index.cpp +6 -0
  108. package/src/Support/SourceMgr.cpp +31 -0
  109. package/src/Support/TargetSelect.cpp +54 -0
  110. package/src/Support/index.cpp +6 -0
  111. package/src/Target/TargetMachine.cpp +37 -0
  112. package/src/Target/index.cpp +5 -0
  113. package/src/Util/Inherit.cpp +13 -0
  114. package/src/llvm-bindings.cpp +26 -0
  115. package/test/add.ts +32 -0
  116. package/test/attribute.ts +37 -0
  117. package/test/bitcode/add.bc +0 -0
  118. package/test/bitcodeWriter.ts +44 -0
  119. package/test/class.ts +39 -0
  120. package/test/debugInfo.ts +181 -0
  121. package/test/exception.ts +57 -0
  122. package/test/fibonacci.ts +44 -0
  123. package/test/gep.ts +42 -0
  124. package/test/index.ts +33 -0
  125. package/test/intrinsic.ts +35 -0
  126. package/test/linker.ts +48 -0
  127. package/test/str.ts +19 -0
  128. package/test/switch.ts +58 -0
  129. package/test/target.ts +14 -0
  130. package/test/type.ts +21 -0
  131. package/test/unary.ts +53 -0
  132. package/test/variable.ts +37 -0
  133. package/tests/Bitcode/BitcodeWriter.spec.ts +26 -0
  134. package/tests/Config/llvm-config.spec.ts +13 -0
  135. package/tests/IR/LLVMContext.spec.ts +8 -0
  136. package/tests/IR/Module.spec.ts +362 -0
  137. package/tests/IR/__snapshots__/Module.spec.ts.snap +11 -0
  138. package/tests/Support/TargetRegistry.spec.ts +38 -0
  139. package/tests/Support/TargetSelect.spec.ts +19 -0
  140. package/tests/Target/TargetMachine.spec.ts +19 -0
  141. package/tsconfig.json +15 -0
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/ADT/APInt.h>
5
+
6
+ class APInt : public Napi::ObjectWrap<APInt> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT;
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static bool IsClassOf(const Napi::Value &value);
13
+
14
+ static llvm::APInt &Extract(const Napi::Value &value);
15
+
16
+ explicit APInt(const Napi::CallbackInfo &info);
17
+
18
+ llvm::APInt &getLLVMPrimitive();
19
+
20
+ private:
21
+ llvm::APInt *apInt = nullptr;
22
+ };
@@ -0,0 +1,7 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include "ADT/APInt.h"
5
+ #include "ADT/APFloat.h"
6
+
7
+ void InitADT(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,8 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/BinaryFormat/Dwarf.h>
5
+
6
+ namespace dwarf {
7
+ void Init(Napi::Env env, Napi::Object &exports);
8
+ }
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include "BinaryFormat/Dwarf.h"
5
+
6
+ void InitBinaryFormat(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/Bitcode/BitcodeWriter.h>
5
+
6
+ void InitBitcodeWriter(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include "Bitcode/BitcodeWriter.h"
5
+
6
+ void InitBitCode(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include "Config/llvm-config.h"
5
+
6
+ void InitConfig(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,6 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/Config/llvm-config.h>
5
+
6
+ void InitLLVMConfig(Napi::Env env, Napi::Object &exports);
@@ -0,0 +1,32 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/Argument.h>
5
+
6
+ class Argument : public Napi::ObjectWrap<Argument> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::Argument *argument);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::Argument *Extract(const Napi::Value &value);
17
+
18
+ explicit Argument(const Napi::CallbackInfo &info);
19
+
20
+ llvm::Argument *getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::Argument *argument = nullptr;
24
+
25
+ Napi::Value getParent(const Napi::CallbackInfo &info);
26
+
27
+ Napi::Value getArgNo(const Napi::CallbackInfo &info);
28
+
29
+ Napi::Value getType(const Napi::CallbackInfo &info);
30
+
31
+ void setName(const Napi::CallbackInfo &info);
32
+ };
@@ -0,0 +1,26 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/Attributes.h>
5
+
6
+ class Attribute : public Napi::ObjectWrap<Attribute> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::AttributeImpl *_attrImpl);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::Attribute Extract(const Napi::Value &value);
17
+
18
+ explicit Attribute(const Napi::CallbackInfo &info);
19
+
20
+ llvm::Attribute getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::AttributeImpl *attrImpl = nullptr;
24
+
25
+ static Napi::Value get(const Napi::CallbackInfo &info);
26
+ };
@@ -0,0 +1,46 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/BasicBlock.h>
5
+
6
+ class BasicBlock : public Napi::ObjectWrap<BasicBlock> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::BasicBlock *basicBlock);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::BasicBlock *Extract(const Napi::Value &value);
17
+
18
+ explicit BasicBlock(const Napi::CallbackInfo &info);
19
+
20
+ llvm::BasicBlock *getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::BasicBlock *basicBlock = nullptr;
24
+
25
+ static Napi::Value Create(const Napi::CallbackInfo &info);
26
+
27
+ Napi::Value getParent(const Napi::CallbackInfo &info);
28
+
29
+ Napi::Value getModule(const Napi::CallbackInfo &info);
30
+
31
+ Napi::Value getTerminator(const Napi::CallbackInfo &info);
32
+
33
+ Napi::Value getFirstNonPHI(const Napi::CallbackInfo &info);
34
+
35
+ void insertInto(const Napi::CallbackInfo &info);
36
+
37
+ void removeFromParent(const Napi::CallbackInfo &info);
38
+
39
+ void eraseFromParent(const Napi::CallbackInfo &info);
40
+
41
+ Napi::Value useEmpty(const Napi::CallbackInfo &info);
42
+
43
+ Napi::Value getType(const Napi::CallbackInfo &info);
44
+
45
+ void deleteSelf(const Napi::CallbackInfo &info);
46
+ };
@@ -0,0 +1,36 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/Constant.h>
5
+
6
+ class Constant : public Napi::ObjectWrap<Constant> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::Constant *constant);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::Constant *Extract(const Napi::Value &value);
17
+
18
+ explicit Constant(const Napi::CallbackInfo &info);
19
+
20
+ llvm::Constant *getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::Constant *constant = nullptr;
24
+
25
+ static Napi::Value getNullValue(const Napi::CallbackInfo &info);
26
+
27
+ static Napi::Value getAllOnesValue(const Napi::CallbackInfo &info);
28
+
29
+ Napi::Value isNullValue(const Napi::CallbackInfo &info);
30
+
31
+ Napi::Value isOneValue(const Napi::CallbackInfo &info);
32
+
33
+ Napi::Value isAllOnesValue(const Napi::CallbackInfo &info);
34
+
35
+ Napi::Value getType(const Napi::CallbackInfo &info);
36
+ };
@@ -0,0 +1,200 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/Constants.h>
5
+
6
+ class ConstantInt : public Napi::ObjectWrap<ConstantInt> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::ConstantInt *constantInt);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::ConstantInt *Extract(const Napi::Value &value);
17
+
18
+ explicit ConstantInt(const Napi::CallbackInfo &info);
19
+
20
+ llvm::ConstantInt *getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::ConstantInt *constantInt = nullptr;
24
+
25
+ static Napi::Value get(const Napi::CallbackInfo &info);
26
+
27
+ Napi::Value getType(const Napi::CallbackInfo &info);
28
+ };
29
+
30
+ class ConstantFP : public Napi::ObjectWrap<ConstantFP> {
31
+ public:
32
+ static inline Napi::FunctionReference constructor; // NOLINT
33
+
34
+ static void Init(Napi::Env env, Napi::Object &exports);
35
+
36
+ static Napi::Object New(Napi::Env env, llvm::ConstantFP *constantFP);
37
+
38
+ static bool IsClassOf(const Napi::Value &value);
39
+
40
+ static llvm::ConstantFP *Extract(const Napi::Value &value);
41
+
42
+ explicit ConstantFP(const Napi::CallbackInfo &info);
43
+
44
+ llvm::ConstantFP *getLLVMPrimitive();
45
+
46
+ private:
47
+ llvm::ConstantFP *constantFP = nullptr;
48
+
49
+ static Napi::Value get(const Napi::CallbackInfo &info);
50
+
51
+ static Napi::Value getNaN(const Napi::CallbackInfo &info);
52
+
53
+ Napi::Value getType(const Napi::CallbackInfo &info);
54
+ };
55
+
56
+ class ConstantArray : public Napi::ObjectWrap<ConstantArray> {
57
+ public:
58
+ static inline Napi::FunctionReference constructor; // NOLINT
59
+
60
+ static void Init(Napi::Env env, Napi::Object &exports);
61
+
62
+ static Napi::Object New(Napi::Env env, llvm::ConstantArray *constantArray);
63
+
64
+ static bool IsClassOf(const Napi::Value &value);
65
+
66
+ static llvm::ConstantArray *Extract(const Napi::Value &value);
67
+
68
+ explicit ConstantArray(const Napi::CallbackInfo &info);
69
+
70
+ llvm::ConstantArray *getLLVMPrimitive();
71
+
72
+ private:
73
+ llvm::ConstantArray *constantArray = nullptr;
74
+
75
+ static Napi::Value get(const Napi::CallbackInfo &info);
76
+
77
+ Napi::Value getType(const Napi::CallbackInfo &info);
78
+ };
79
+
80
+ class ConstantStruct : public Napi::ObjectWrap<ConstantStruct> {
81
+ public:
82
+ static inline Napi::FunctionReference constructor; // NOLINT
83
+
84
+ static void Init(Napi::Env env, Napi::Object &exports);
85
+
86
+ static Napi::Object New(Napi::Env env, llvm::ConstantStruct *constantStruct);
87
+
88
+ static bool IsClassOf(const Napi::Value &value);
89
+
90
+ static llvm::ConstantStruct *Extract(const Napi::Value &value);
91
+
92
+ explicit ConstantStruct(const Napi::CallbackInfo &info);
93
+
94
+ llvm::ConstantStruct *getLLVMPrimitive();
95
+
96
+ private:
97
+ llvm::ConstantStruct *constantStruct = nullptr;
98
+
99
+ static Napi::Value get(const Napi::CallbackInfo &info);
100
+
101
+ Napi::Value getType(const Napi::CallbackInfo &info);
102
+ };
103
+
104
+ class ConstantPointerNull : public Napi::ObjectWrap<ConstantPointerNull> {
105
+ public:
106
+ static inline Napi::FunctionReference constructor; // NOLINT
107
+
108
+ static void Init(Napi::Env env, Napi::Object &exports);
109
+
110
+ static Napi::Object New(Napi::Env env, llvm::ConstantPointerNull *constantPointerNull);
111
+
112
+ static bool IsClassOf(const Napi::Value &value);
113
+
114
+ static llvm::ConstantPointerNull *Extract(const Napi::Value &value);
115
+
116
+ explicit ConstantPointerNull(const Napi::CallbackInfo &info);
117
+
118
+ llvm::ConstantPointerNull *getLLVMPrimitive();
119
+
120
+ private:
121
+ llvm::ConstantPointerNull *constantPointerNull = nullptr;
122
+
123
+ static Napi::Value get(const Napi::CallbackInfo &info);
124
+
125
+ Napi::Value getType(const Napi::CallbackInfo &info);
126
+ };
127
+
128
+ class ConstantDataArray : public Napi::ObjectWrap<ConstantDataArray> {
129
+ public:
130
+ static inline Napi::FunctionReference constructor; // NOLINT
131
+
132
+ static void Init(Napi::Env env, Napi::Object &exports);
133
+
134
+ static Napi::Object New(Napi::Env env, llvm::ConstantDataArray *constantDataArray);
135
+
136
+ static bool IsClassOf(const Napi::Value &value);
137
+
138
+ static llvm::ConstantDataArray *Extract(const Napi::Value &value);
139
+
140
+ explicit ConstantDataArray(const Napi::CallbackInfo &info);
141
+
142
+ llvm::ConstantDataArray *getLLVMPrimitive();
143
+
144
+ private:
145
+ llvm::ConstantDataArray *constantDataArray = nullptr;
146
+
147
+ static Napi::Value get(const Napi::CallbackInfo &info);
148
+
149
+ static Napi::Value getString(const Napi::CallbackInfo &info);
150
+
151
+ Napi::Value getType(const Napi::CallbackInfo &info);
152
+ };
153
+
154
+ class ConstantExpr : public Napi::ObjectWrap<ConstantExpr> {
155
+ public:
156
+ static inline Napi::FunctionReference constructor; // NOLINT
157
+
158
+ static void Init(Napi::Env env, Napi::Object &exports);
159
+
160
+ static Napi::Object New(Napi::Env env, llvm::ConstantExpr *constantExpr);
161
+
162
+ static bool IsClassOf(const Napi::Value &value);
163
+
164
+ static llvm::ConstantExpr *Extract(const Napi::Value &value);
165
+
166
+ explicit ConstantExpr(const Napi::CallbackInfo &info);
167
+
168
+ llvm::ConstantExpr *getLLVMPrimitive();
169
+
170
+ private:
171
+ llvm::ConstantExpr *constantExpr = nullptr;
172
+
173
+ static Napi::Value getBitCast(const Napi::CallbackInfo &info);
174
+
175
+ Napi::Value getType(const Napi::CallbackInfo &info);
176
+ };
177
+
178
+ class UndefValue : public Napi::ObjectWrap<UndefValue> {
179
+ public:
180
+ static inline Napi::FunctionReference constructor; // NOLINT
181
+
182
+ static void Init(Napi::Env env, Napi::Object &exports);
183
+
184
+ static Napi::Object New(Napi::Env env, llvm::UndefValue *undefValue);
185
+
186
+ static bool IsClassOf(const Napi::Value &value);
187
+
188
+ static llvm::UndefValue *Extract(const Napi::Value &value);
189
+
190
+ explicit UndefValue(const Napi::CallbackInfo &info);
191
+
192
+ llvm::UndefValue *getLLVMPrimitive();
193
+
194
+ private:
195
+ llvm::UndefValue *undefValue = nullptr;
196
+
197
+ static Napi::Value get(const Napi::CallbackInfo &info);
198
+
199
+ Napi::Value getType(const Napi::CallbackInfo &info);
200
+ };
@@ -0,0 +1,54 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/DIBuilder.h>
5
+
6
+ class DIBuilder : public Napi::ObjectWrap<DIBuilder> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Value New(Napi::Env env, llvm::DIBuilder *builder);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::DIBuilder *Extract(const Napi::Value &value);
17
+
18
+ explicit DIBuilder(const Napi::CallbackInfo &info);
19
+
20
+ llvm::DIBuilder *getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::DIBuilder *builder = nullptr;
24
+
25
+ Napi::Value createFile(const Napi::CallbackInfo &info);
26
+
27
+ Napi::Value createCompileUnit(const Napi::CallbackInfo &info);
28
+
29
+ Napi::Value createFunction(const Napi::CallbackInfo &info);
30
+
31
+ Napi::Value createLexicalBlock(const Napi::CallbackInfo &info);
32
+
33
+ Napi::Value createBasicType(const Napi::CallbackInfo &info);
34
+
35
+ Napi::Value getOrCreateTypeArray(const Napi::CallbackInfo &info);
36
+
37
+ Napi::Value createSubroutineType(const Napi::CallbackInfo &info);
38
+
39
+ Napi::Value createExpression(const Napi::CallbackInfo &info);
40
+
41
+ Napi::Value createParameterVariable(const Napi::CallbackInfo &info);
42
+
43
+ Napi::Value createAutoVariable(const Napi::CallbackInfo &info);
44
+
45
+ Napi::Value createGlobalVariableExpression(const Napi::CallbackInfo &info);
46
+
47
+ Napi::Value insertDeclare(const Napi::CallbackInfo &info);
48
+
49
+ Napi::Value insertDbgValueIntrinsic(const Napi::CallbackInfo &info);
50
+
51
+ void finalizeSubprogram(const Napi::CallbackInfo &info);
52
+
53
+ void finalize(const Napi::CallbackInfo &info);
54
+ };
@@ -0,0 +1,28 @@
1
+ #pragma once
2
+
3
+ #include <napi.h>
4
+ #include <llvm/IR/DataLayout.h>
5
+
6
+ class DataLayout : public Napi::ObjectWrap<DataLayout> {
7
+ public:
8
+ static inline Napi::FunctionReference constructor; // NOLINT
9
+
10
+ static void Init(Napi::Env env, Napi::Object &exports);
11
+
12
+ static Napi::Object New(Napi::Env env, llvm::DataLayout *dl);
13
+
14
+ static bool IsClassOf(const Napi::Value &value);
15
+
16
+ static llvm::DataLayout &Extract(const Napi::Value &value);
17
+
18
+ explicit DataLayout(const Napi::CallbackInfo &info);
19
+
20
+ llvm::DataLayout &getLLVMPrimitive();
21
+
22
+ private:
23
+ llvm::DataLayout *dataLayout = nullptr;
24
+
25
+ Napi::Value getStringRepresentation(const Napi::CallbackInfo &info);
26
+
27
+ Napi::Value getTypeAllocSize(const Napi::CallbackInfo &info);
28
+ };