xref: /freebsd/contrib/llvm-project/llvm/include/llvm-c/IRReader.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
10b57cec5SDimitry Andric /*===-- llvm-c/IRReader.h - IR Reader C Interface -----------------*- C -*-===*\
20b57cec5SDimitry Andric |*                                                                            *|
30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
40b57cec5SDimitry Andric |* Exceptions.                                                                *|
50b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.                  *|
60b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
70b57cec5SDimitry Andric |*                                                                            *|
80b57cec5SDimitry Andric |*===----------------------------------------------------------------------===*|
90b57cec5SDimitry Andric |*                                                                            *|
100b57cec5SDimitry Andric |* This file defines the C interface to the IR Reader.                        *|
110b57cec5SDimitry Andric |*                                                                            *|
120b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_C_IRREADER_H
150b57cec5SDimitry Andric #define LLVM_C_IRREADER_H
160b57cec5SDimitry Andric 
17480093f4SDimitry Andric #include "llvm-c/ExternC.h"
180b57cec5SDimitry Andric #include "llvm-c/Types.h"
190b57cec5SDimitry Andric 
20480093f4SDimitry Andric LLVM_C_EXTERN_C_BEGIN
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric /**
23*349cc55cSDimitry Andric  * @defgroup LLVMCCoreIRReader IR Reader
24*349cc55cSDimitry Andric  * @ingroup LLVMCCore
25*349cc55cSDimitry Andric  *
26*349cc55cSDimitry Andric  * @{
27*349cc55cSDimitry Andric  */
28*349cc55cSDimitry Andric 
29*349cc55cSDimitry Andric /**
300b57cec5SDimitry Andric  * Read LLVM IR from a memory buffer and convert it into an in-memory Module
310b57cec5SDimitry Andric  * object. Returns 0 on success.
320b57cec5SDimitry Andric  * Optionally returns a human-readable description of any errors that
330b57cec5SDimitry Andric  * occurred during parsing IR. OutMessage must be disposed with
340b57cec5SDimitry Andric  * LLVMDisposeMessage.
350b57cec5SDimitry Andric  *
360b57cec5SDimitry Andric  * @see llvm::ParseIR()
370b57cec5SDimitry Andric  */
380b57cec5SDimitry Andric LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
390b57cec5SDimitry Andric                               LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
400b57cec5SDimitry Andric                               char **OutMessage);
410b57cec5SDimitry Andric 
42*349cc55cSDimitry Andric /**
43*349cc55cSDimitry Andric  * @}
44*349cc55cSDimitry Andric  */
45*349cc55cSDimitry Andric 
46480093f4SDimitry Andric LLVM_C_EXTERN_C_END
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric #endif
49