BuildSystem.h 5.4 KB

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