BitReader.h 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
  7. |* *|
  8. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  9. |* Exceptions. *|
  10. |* See https://llvm.org/LICENSE.txt for license information. *|
  11. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  12. |* *|
  13. |*===----------------------------------------------------------------------===*|
  14. |* *|
  15. |* This header declares the C interface to libLLVMBitReader.a, which *|
  16. |* implements input of the LLVM bitcode format. *|
  17. |* *|
  18. |* Many exotic languages can interoperate with C code but have a harder time *|
  19. |* with C++ due to name mangling. So in addition to C, this interface enables *|
  20. |* tools written in such languages. *|
  21. |* *|
  22. \*===----------------------------------------------------------------------===*/
  23. #ifndef LLVM_C_BITREADER_H
  24. #define LLVM_C_BITREADER_H
  25. #include "llvm-c/ExternC.h"
  26. #include "llvm-c/Types.h"
  27. LLVM_C_EXTERN_C_BEGIN
  28. /**
  29. * @defgroup LLVMCBitReader Bit Reader
  30. * @ingroup LLVMC
  31. *
  32. * @{
  33. */
  34. /* Builds a module from the bitcode in the specified memory buffer, returning a
  35. reference to the module via the OutModule parameter. Returns 0 on success.
  36. Optionally returns a human-readable error message via OutMessage.
  37. This is deprecated. Use LLVMParseBitcode2. */
  38. LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule,
  39. char **OutMessage);
  40. /* Builds a module from the bitcode in the specified memory buffer, returning a
  41. reference to the module via the OutModule parameter. Returns 0 on success. */
  42. LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf,
  43. LLVMModuleRef *OutModule);
  44. /* This is deprecated. Use LLVMParseBitcodeInContext2. */
  45. LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
  46. LLVMMemoryBufferRef MemBuf,
  47. LLVMModuleRef *OutModule, char **OutMessage);
  48. LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef,
  49. LLVMMemoryBufferRef MemBuf,
  50. LLVMModuleRef *OutModule);
  51. /** Reads a module from the specified path, returning via the OutMP parameter
  52. a module provider which performs lazy deserialization. Returns 0 on success.
  53. Optionally returns a human-readable error message via OutMessage.
  54. This is deprecated. Use LLVMGetBitcodeModuleInContext2. */
  55. LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
  56. LLVMMemoryBufferRef MemBuf,
  57. LLVMModuleRef *OutM, char **OutMessage);
  58. /** Reads a module from the given memory buffer, returning via the OutMP
  59. * parameter a module provider which performs lazy deserialization.
  60. *
  61. * Returns 0 on success.
  62. *
  63. * Takes ownership of \p MemBuf if (and only if) the module was read
  64. * successfully. */
  65. LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
  66. LLVMMemoryBufferRef MemBuf,
  67. LLVMModuleRef *OutM);
  68. /* This is deprecated. Use LLVMGetBitcodeModule2. */
  69. LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
  70. char **OutMessage);
  71. LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM);
  72. /**
  73. * @}
  74. */
  75. LLVM_C_EXTERN_C_END
  76. #endif
  77. #ifdef __GNUC__
  78. #pragma GCC diagnostic pop
  79. #endif