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