15
15
16
16
#include " llvm/ADT/STLFunctionalExtras.h"
17
17
#include " llvm/ADT/StringRef.h"
18
+ #include " llvm/Support/Compiler.h"
18
19
#include < memory>
19
20
#include < optional>
20
21
@@ -44,9 +45,9 @@ typedef llvm::function_ref<std::optional<std::string>(StringRef, StringRef)>
44
45
// / \param Context Context in which to allocate globals info.
45
46
// / \param Slots The optional slot mapping that will be initialized during
46
47
// / parsing.
47
- std::unique_ptr<Module> parseAssemblyFile (StringRef Filename, SMDiagnostic &Err,
48
- LLVMContext &Context,
49
- SlotMapping *Slots = nullptr );
48
+ LLVM_ABI std::unique_ptr<Module>
49
+ parseAssemblyFile (StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
50
+ SlotMapping *Slots = nullptr );
50
51
51
52
// / The function is a secondary interface to the LLVM Assembly Parser. It parses
52
53
// / an ASCII string that (presumably) contains LLVM Assembly code. It returns a
@@ -59,10 +60,9 @@ std::unique_ptr<Module> parseAssemblyFile(StringRef Filename, SMDiagnostic &Err,
59
60
// / \param Context Context in which to allocate globals info.
60
61
// / \param Slots The optional slot mapping that will be initialized during
61
62
// / parsing.
62
- std::unique_ptr<Module> parseAssemblyString (StringRef AsmString,
63
- SMDiagnostic &Err,
64
- LLVMContext &Context,
65
- SlotMapping *Slots = nullptr );
63
+ LLVM_ABI std::unique_ptr<Module>
64
+ parseAssemblyString (StringRef AsmString, SMDiagnostic &Err,
65
+ LLVMContext &Context, SlotMapping *Slots = nullptr );
66
66
67
67
// / Holds the Module and ModuleSummaryIndex returned by the interfaces
68
68
// / that parse both.
@@ -84,15 +84,15 @@ struct ParsedModuleAndIndex {
84
84
// / \param Slots The optional slot mapping that will be initialized during
85
85
// / parsing.
86
86
// / \param DataLayoutCallback Override datalayout in the llvm assembly.
87
- ParsedModuleAndIndex parseAssemblyFileWithIndex (
87
+ LLVM_ABI ParsedModuleAndIndex parseAssemblyFileWithIndex (
88
88
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
89
89
SlotMapping *Slots = nullptr ,
90
90
DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
91
91
return std::nullopt;
92
92
});
93
93
94
94
// / Only for use in llvm-as for testing; this does not produce a valid module.
95
- ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo (
95
+ LLVM_ABI ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo (
96
96
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
97
97
SlotMapping *Slots, DataLayoutCallbackTy DataLayoutCallback);
98
98
@@ -104,7 +104,7 @@ ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo(
104
104
// / Parse LLVM Assembly Index from a file
105
105
// / \param Filename The name of the file to parse
106
106
// / \param Err Error result info.
107
- std::unique_ptr<ModuleSummaryIndex>
107
+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
108
108
parseSummaryIndexAssemblyFile (StringRef Filename, SMDiagnostic &Err);
109
109
110
110
// / The function is a secondary interface to the LLVM Assembly Parser. It parses
@@ -115,7 +115,7 @@ parseSummaryIndexAssemblyFile(StringRef Filename, SMDiagnostic &Err);
115
115
// / Parse LLVM Assembly from a string
116
116
// / \param AsmString The string containing assembly
117
117
// / \param Err Error result info.
118
- std::unique_ptr<ModuleSummaryIndex>
118
+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
119
119
parseSummaryIndexAssemblyString (StringRef AsmString, SMDiagnostic &Err);
120
120
121
121
// / parseAssemblyFile and parseAssemblyString are wrappers around this function.
@@ -125,7 +125,7 @@ parseSummaryIndexAssemblyString(StringRef AsmString, SMDiagnostic &Err);
125
125
// / \param Slots The optional slot mapping that will be initialized during
126
126
// / parsing.
127
127
// / \param DataLayoutCallback Override datalayout in the llvm assembly.
128
- std::unique_ptr<Module> parseAssembly (
128
+ LLVM_ABI std::unique_ptr<Module> parseAssembly (
129
129
MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
130
130
SlotMapping *Slots = nullptr ,
131
131
DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
@@ -140,18 +140,17 @@ std::unique_ptr<Module> parseAssembly(
140
140
// / parsing.
141
141
// /
142
142
// / parseAssemblyFileWithIndex is a wrapper around this function.
143
- ParsedModuleAndIndex parseAssemblyWithIndex (MemoryBufferRef F,
144
- SMDiagnostic &Err,
145
- LLVMContext &Context,
146
- SlotMapping *Slots = nullptr );
143
+ LLVM_ABI ParsedModuleAndIndex
144
+ parseAssemblyWithIndex (MemoryBufferRef F, SMDiagnostic &Err,
145
+ LLVMContext &Context, SlotMapping *Slots = nullptr );
147
146
148
147
// / Parse LLVM Assembly for summary index from a MemoryBuffer.
149
148
// /
150
149
// / \param F The MemoryBuffer containing assembly with summary
151
150
// / \param Err Error result info.
152
151
// /
153
152
// / parseSummaryIndexAssemblyFile is a wrapper around this function.
154
- std::unique_ptr<ModuleSummaryIndex>
153
+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
155
154
parseSummaryIndexAssembly (MemoryBufferRef F, SMDiagnostic &Err);
156
155
157
156
// / This function is the low-level interface to the LLVM Assembly Parser.
@@ -167,7 +166,7 @@ parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err);
167
166
// / parsing.
168
167
// / \return true on error.
169
168
// / \param DataLayoutCallback Override datalayout in the llvm assembly.
170
- bool parseAssemblyInto (
169
+ LLVM_ABI bool parseAssemblyInto (
171
170
MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err,
172
171
SlotMapping *Slots = nullptr ,
173
172
DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
@@ -182,16 +181,17 @@ bool parseAssemblyInto(
182
181
// / \param Slots The optional slot mapping that will restore the parsing state
183
182
// / of the module.
184
183
// / \return null on error.
185
- Constant *parseConstantValue (StringRef Asm, SMDiagnostic &Err, const Module &M,
186
- const SlotMapping *Slots = nullptr );
184
+ LLVM_ABI Constant *parseConstantValue (StringRef Asm, SMDiagnostic &Err,
185
+ const Module &M,
186
+ const SlotMapping *Slots = nullptr );
187
187
188
188
// / Parse a type in the given string.
189
189
// /
190
190
// / \param Slots The optional slot mapping that will restore the parsing state
191
191
// / of the module.
192
192
// / \return null on error.
193
- Type *parseType (StringRef Asm, SMDiagnostic &Err, const Module &M,
194
- const SlotMapping *Slots = nullptr );
193
+ LLVM_ABI Type *parseType (StringRef Asm, SMDiagnostic &Err, const Module &M,
194
+ const SlotMapping *Slots = nullptr );
195
195
196
196
// / Parse a string \p Asm that starts with a type.
197
197
// / \p Read[out] gives the number of characters that have been read to parse
@@ -200,13 +200,14 @@ Type *parseType(StringRef Asm, SMDiagnostic &Err, const Module &M,
200
200
// / \param Slots The optional slot mapping that will restore the parsing state
201
201
// / of the module.
202
202
// / \return null on error.
203
- Type *parseTypeAtBeginning (StringRef Asm, unsigned &Read, SMDiagnostic &Err,
204
- const Module &M, const SlotMapping *Slots = nullptr );
205
-
206
- DIExpression *parseDIExpressionBodyAtBeginning (StringRef Asm, unsigned &Read,
207
- SMDiagnostic &Err,
208
- const Module &M,
209
- const SlotMapping *Slots);
203
+ LLVM_ABI Type *parseTypeAtBeginning (StringRef Asm, unsigned &Read,
204
+ SMDiagnostic &Err, const Module &M,
205
+ const SlotMapping *Slots = nullptr );
206
+
207
+ LLVM_ABI DIExpression *
208
+ parseDIExpressionBodyAtBeginning (StringRef Asm, unsigned &Read,
209
+ SMDiagnostic &Err, const Module &M,
210
+ const SlotMapping *Slots);
210
211
211
212
} // End llvm namespace
212
213
0 commit comments