BuildSystem.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. /*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- 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 provides various utilities for use by build systems. *|
  16. |* *|
  17. \*===----------------------------------------------------------------------===*/
  18. #ifndef LLVM_CLANG_C_BUILDSYSTEM_H
  19. #define LLVM_CLANG_C_BUILDSYSTEM_H
  20. #include "clang-c/CXErrorCode.h"
  21. #include "clang-c/CXString.h"
  22. #include "clang-c/ExternC.h"
  23. #include "clang-c/Platform.h"
  24. LLVM_CLANG_C_EXTERN_C_BEGIN
  25. /**
  26. * \defgroup BUILD_SYSTEM Build system utilities
  27. * @{
  28. */
  29. /**
  30. * Return the timestamp for use with Clang's
  31. * \c -fbuild-session-timestamp= option.
  32. */
  33. CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
  34. /**
  35. * Object encapsulating information about overlaying virtual
  36. * file/directories over the real file system.
  37. */
  38. typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
  39. /**
  40. * Create a \c CXVirtualFileOverlay object.
  41. * Must be disposed with \c clang_VirtualFileOverlay_dispose().
  42. *
  43. * \param options is reserved, always pass 0.
  44. */
  45. CINDEX_LINKAGE CXVirtualFileOverlay
  46. clang_VirtualFileOverlay_create(unsigned options);
  47. /**
  48. * Map an absolute virtual file path to an absolute real one.
  49. * The virtual path must be canonicalized (not contain "."/"..").
  50. * \returns 0 for success, non-zero to indicate an error.
  51. */
  52. CINDEX_LINKAGE enum CXErrorCode
  53. clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
  54. const char *virtualPath,
  55. const char *realPath);
  56. /**
  57. * Set the case sensitivity for the \c CXVirtualFileOverlay object.
  58. * The \c CXVirtualFileOverlay object is case-sensitive by default, this
  59. * option can be used to override the default.
  60. * \returns 0 for success, non-zero to indicate an error.
  61. */
  62. CINDEX_LINKAGE enum CXErrorCode
  63. clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
  64. int caseSensitive);
  65. /**
  66. * Write out the \c CXVirtualFileOverlay object to a char buffer.
  67. *
  68. * \param options is reserved, always pass 0.
  69. * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
  70. * disposed using \c clang_free().
  71. * \param out_buffer_size pointer to receive the buffer size.
  72. * \returns 0 for success, non-zero to indicate an error.
  73. */
  74. CINDEX_LINKAGE enum CXErrorCode
  75. clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
  76. char **out_buffer_ptr,
  77. unsigned *out_buffer_size);
  78. /**
  79. * free memory allocated by libclang, such as the buffer returned by
  80. * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
  81. *
  82. * \param buffer memory pointer to free.
  83. */
  84. CINDEX_LINKAGE void clang_free(void *buffer);
  85. /**
  86. * Dispose a \c CXVirtualFileOverlay object.
  87. */
  88. CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
  89. /**
  90. * Object encapsulating information about a module.map file.
  91. */
  92. typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
  93. /**
  94. * Create a \c CXModuleMapDescriptor object.
  95. * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
  96. *
  97. * \param options is reserved, always pass 0.
  98. */
  99. CINDEX_LINKAGE CXModuleMapDescriptor
  100. clang_ModuleMapDescriptor_create(unsigned options);
  101. /**
  102. * Sets the framework module name that the module.map describes.
  103. * \returns 0 for success, non-zero to indicate an error.
  104. */
  105. CINDEX_LINKAGE enum CXErrorCode
  106. clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
  107. const char *name);
  108. /**
  109. * Sets the umbrella header name that the module.map describes.
  110. * \returns 0 for success, non-zero to indicate an error.
  111. */
  112. CINDEX_LINKAGE enum CXErrorCode
  113. clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
  114. const char *name);
  115. /**
  116. * Write out the \c CXModuleMapDescriptor object to a char buffer.
  117. *
  118. * \param options is reserved, always pass 0.
  119. * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
  120. * disposed using \c clang_free().
  121. * \param out_buffer_size pointer to receive the buffer size.
  122. * \returns 0 for success, non-zero to indicate an error.
  123. */
  124. CINDEX_LINKAGE enum CXErrorCode
  125. clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
  126. char **out_buffer_ptr,
  127. unsigned *out_buffer_size);
  128. /**
  129. * Dispose a \c CXModuleMapDescriptor object.
  130. */
  131. CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
  132. /**
  133. * @}
  134. */
  135. LLVM_CLANG_C_EXTERN_C_END
  136. #endif /* CLANG_C_BUILD_SYSTEM_H */
  137. #ifdef __GNUC__
  138. #pragma GCC diagnostic pop
  139. #endif