1515
1616#include " llvm/ADT/STLFunctionalExtras.h"
1717#include " llvm/ADT/StringRef.h"
18+ #include " llvm/Support/Compiler.h"
1819#include < memory>
1920#include < optional>
2021
@@ -44,9 +45,9 @@ typedef llvm::function_ref<std::optional<std::string>(StringRef, StringRef)>
4445// / \param Context Context in which to allocate globals info.
4546// / \param Slots The optional slot mapping that will be initialized during
4647// / 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 );
5051
5152// / The function is a secondary interface to the LLVM Assembly Parser. It parses
5253// / 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,
5960// / \param Context Context in which to allocate globals info.
6061// / \param Slots The optional slot mapping that will be initialized during
6162// / 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 );
6666
6767// / Holds the Module and ModuleSummaryIndex returned by the interfaces
6868// / that parse both.
@@ -84,15 +84,15 @@ struct ParsedModuleAndIndex {
8484// / \param Slots The optional slot mapping that will be initialized during
8585// / parsing.
8686// / \param DataLayoutCallback Override datalayout in the llvm assembly.
87- ParsedModuleAndIndex parseAssemblyFileWithIndex (
87+ LLVM_ABI ParsedModuleAndIndex parseAssemblyFileWithIndex (
8888 StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
8989 SlotMapping *Slots = nullptr ,
9090 DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
9191 return std::nullopt ;
9292 });
9393
9494// / Only for use in llvm-as for testing; this does not produce a valid module.
95- ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo (
95+ LLVM_ABI ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo (
9696 StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
9797 SlotMapping *Slots, DataLayoutCallbackTy DataLayoutCallback);
9898
@@ -104,7 +104,7 @@ ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo(
104104// / Parse LLVM Assembly Index from a file
105105// / \param Filename The name of the file to parse
106106// / \param Err Error result info.
107- std::unique_ptr<ModuleSummaryIndex>
107+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
108108parseSummaryIndexAssemblyFile (StringRef Filename, SMDiagnostic &Err);
109109
110110// / The function is a secondary interface to the LLVM Assembly Parser. It parses
@@ -115,7 +115,7 @@ parseSummaryIndexAssemblyFile(StringRef Filename, SMDiagnostic &Err);
115115// / Parse LLVM Assembly from a string
116116// / \param AsmString The string containing assembly
117117// / \param Err Error result info.
118- std::unique_ptr<ModuleSummaryIndex>
118+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
119119parseSummaryIndexAssemblyString (StringRef AsmString, SMDiagnostic &Err);
120120
121121// / parseAssemblyFile and parseAssemblyString are wrappers around this function.
@@ -125,7 +125,7 @@ parseSummaryIndexAssemblyString(StringRef AsmString, SMDiagnostic &Err);
125125// / \param Slots The optional slot mapping that will be initialized during
126126// / parsing.
127127// / \param DataLayoutCallback Override datalayout in the llvm assembly.
128- std::unique_ptr<Module> parseAssembly (
128+ LLVM_ABI std::unique_ptr<Module> parseAssembly (
129129 MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
130130 SlotMapping *Slots = nullptr ,
131131 DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
@@ -140,18 +140,17 @@ std::unique_ptr<Module> parseAssembly(
140140// / parsing.
141141// /
142142// / 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 );
147146
148147// / Parse LLVM Assembly for summary index from a MemoryBuffer.
149148// /
150149// / \param F The MemoryBuffer containing assembly with summary
151150// / \param Err Error result info.
152151// /
153152// / parseSummaryIndexAssemblyFile is a wrapper around this function.
154- std::unique_ptr<ModuleSummaryIndex>
153+ LLVM_ABI std::unique_ptr<ModuleSummaryIndex>
155154parseSummaryIndexAssembly (MemoryBufferRef F, SMDiagnostic &Err);
156155
157156// / This function is the low-level interface to the LLVM Assembly Parser.
@@ -167,7 +166,7 @@ parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err);
167166// / parsing.
168167// / \return true on error.
169168// / \param DataLayoutCallback Override datalayout in the llvm assembly.
170- bool parseAssemblyInto (
169+ LLVM_ABI bool parseAssemblyInto (
171170 MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err,
172171 SlotMapping *Slots = nullptr ,
173172 DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
@@ -182,16 +181,17 @@ bool parseAssemblyInto(
182181// / \param Slots The optional slot mapping that will restore the parsing state
183182// / of the module.
184183// / \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 );
187187
188188// / Parse a type in the given string.
189189// /
190190// / \param Slots The optional slot mapping that will restore the parsing state
191191// / of the module.
192192// / \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 );
195195
196196// / Parse a string \p Asm that starts with a type.
197197// / \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,
200200// / \param Slots The optional slot mapping that will restore the parsing state
201201// / of the module.
202202// / \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);
210211
211212} // End llvm namespace
212213
0 commit comments