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