xref: /freebsd-src/contrib/llvm-project/clang/include/clang-c/BuildSystem.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric /*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
20b57cec5SDimitry Andric |*                                                                            *|
30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
40b57cec5SDimitry Andric |* Exceptions.                                                                *|
50b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.                  *|
60b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
70b57cec5SDimitry Andric |*                                                                            *|
80b57cec5SDimitry Andric |*===----------------------------------------------------------------------===*|
90b57cec5SDimitry Andric |*                                                                            *|
100b57cec5SDimitry Andric |* This header provides various utilities for use by build systems.           *|
110b57cec5SDimitry Andric |*                                                                            *|
120b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_CLANG_C_BUILDSYSTEM_H
150b57cec5SDimitry Andric #define LLVM_CLANG_C_BUILDSYSTEM_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric #include "clang-c/CXErrorCode.h"
180b57cec5SDimitry Andric #include "clang-c/CXString.h"
19480093f4SDimitry Andric #include "clang-c/ExternC.h"
20480093f4SDimitry Andric #include "clang-c/Platform.h"
210b57cec5SDimitry Andric 
22480093f4SDimitry Andric LLVM_CLANG_C_EXTERN_C_BEGIN
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric /**
250b57cec5SDimitry Andric  * \defgroup BUILD_SYSTEM Build system utilities
260b57cec5SDimitry Andric  * @{
270b57cec5SDimitry Andric  */
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric /**
300b57cec5SDimitry Andric  * Return the timestamp for use with Clang's
310b57cec5SDimitry Andric  * \c -fbuild-session-timestamp= option.
320b57cec5SDimitry Andric  */
330b57cec5SDimitry Andric CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric /**
360b57cec5SDimitry Andric  * Object encapsulating information about overlaying virtual
370b57cec5SDimitry Andric  * file/directories over the real file system.
380b57cec5SDimitry Andric  */
390b57cec5SDimitry Andric typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric /**
420b57cec5SDimitry Andric  * Create a \c CXVirtualFileOverlay object.
430b57cec5SDimitry Andric  * Must be disposed with \c clang_VirtualFileOverlay_dispose().
440b57cec5SDimitry Andric  *
450b57cec5SDimitry Andric  * \param options is reserved, always pass 0.
460b57cec5SDimitry Andric  */
470b57cec5SDimitry Andric CINDEX_LINKAGE CXVirtualFileOverlay
480b57cec5SDimitry Andric clang_VirtualFileOverlay_create(unsigned options);
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric /**
510b57cec5SDimitry Andric  * Map an absolute virtual file path to an absolute real one.
520b57cec5SDimitry Andric  * The virtual path must be canonicalized (not contain "."/"..").
530b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
540b57cec5SDimitry Andric  */
550b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
560b57cec5SDimitry Andric clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
570b57cec5SDimitry Andric                                         const char *virtualPath,
580b57cec5SDimitry Andric                                         const char *realPath);
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric /**
610b57cec5SDimitry Andric  * Set the case sensitivity for the \c CXVirtualFileOverlay object.
620b57cec5SDimitry Andric  * The \c CXVirtualFileOverlay object is case-sensitive by default, this
630b57cec5SDimitry Andric  * option can be used to override the default.
640b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
650b57cec5SDimitry Andric  */
660b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
670b57cec5SDimitry Andric clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
680b57cec5SDimitry Andric                                             int caseSensitive);
690b57cec5SDimitry Andric 
700b57cec5SDimitry Andric /**
710b57cec5SDimitry Andric  * Write out the \c CXVirtualFileOverlay object to a char buffer.
720b57cec5SDimitry Andric  *
730b57cec5SDimitry Andric  * \param options is reserved, always pass 0.
740b57cec5SDimitry Andric  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
750b57cec5SDimitry Andric  * disposed using \c clang_free().
760b57cec5SDimitry Andric  * \param out_buffer_size pointer to receive the buffer size.
770b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
780b57cec5SDimitry Andric  */
790b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
800b57cec5SDimitry Andric clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
810b57cec5SDimitry Andric                                        char **out_buffer_ptr,
820b57cec5SDimitry Andric                                        unsigned *out_buffer_size);
830b57cec5SDimitry Andric 
840b57cec5SDimitry Andric /**
850b57cec5SDimitry Andric  * free memory allocated by libclang, such as the buffer returned by
860b57cec5SDimitry Andric  * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
870b57cec5SDimitry Andric  *
880b57cec5SDimitry Andric  * \param buffer memory pointer to free.
890b57cec5SDimitry Andric  */
900b57cec5SDimitry Andric CINDEX_LINKAGE void clang_free(void *buffer);
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric /**
930b57cec5SDimitry Andric  * Dispose a \c CXVirtualFileOverlay object.
940b57cec5SDimitry Andric  */
950b57cec5SDimitry Andric CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
960b57cec5SDimitry Andric 
970b57cec5SDimitry Andric /**
98*5f757f3fSDimitry Andric  * Object encapsulating information about a module.modulemap file.
990b57cec5SDimitry Andric  */
1000b57cec5SDimitry Andric typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
1010b57cec5SDimitry Andric 
1020b57cec5SDimitry Andric /**
1030b57cec5SDimitry Andric  * Create a \c CXModuleMapDescriptor object.
1040b57cec5SDimitry Andric  * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
1050b57cec5SDimitry Andric  *
1060b57cec5SDimitry Andric  * \param options is reserved, always pass 0.
1070b57cec5SDimitry Andric  */
1080b57cec5SDimitry Andric CINDEX_LINKAGE CXModuleMapDescriptor
1090b57cec5SDimitry Andric clang_ModuleMapDescriptor_create(unsigned options);
1100b57cec5SDimitry Andric 
1110b57cec5SDimitry Andric /**
112*5f757f3fSDimitry Andric  * Sets the framework module name that the module.modulemap describes.
1130b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
1140b57cec5SDimitry Andric  */
1150b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
1160b57cec5SDimitry Andric clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
1170b57cec5SDimitry Andric                                                  const char *name);
1180b57cec5SDimitry Andric 
1190b57cec5SDimitry Andric /**
120*5f757f3fSDimitry Andric  * Sets the umbrella header name that the module.modulemap describes.
1210b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
1220b57cec5SDimitry Andric  */
1230b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
1240b57cec5SDimitry Andric clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
1250b57cec5SDimitry Andric                                             const char *name);
1260b57cec5SDimitry Andric 
1270b57cec5SDimitry Andric /**
1280b57cec5SDimitry Andric  * Write out the \c CXModuleMapDescriptor object to a char buffer.
1290b57cec5SDimitry Andric  *
1300b57cec5SDimitry Andric  * \param options is reserved, always pass 0.
1310b57cec5SDimitry Andric  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
1320b57cec5SDimitry Andric  * disposed using \c clang_free().
1330b57cec5SDimitry Andric  * \param out_buffer_size pointer to receive the buffer size.
1340b57cec5SDimitry Andric  * \returns 0 for success, non-zero to indicate an error.
1350b57cec5SDimitry Andric  */
1360b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode
1370b57cec5SDimitry Andric clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
1380b57cec5SDimitry Andric                                        char **out_buffer_ptr,
1390b57cec5SDimitry Andric                                        unsigned *out_buffer_size);
1400b57cec5SDimitry Andric 
1410b57cec5SDimitry Andric /**
1420b57cec5SDimitry Andric  * Dispose a \c CXModuleMapDescriptor object.
1430b57cec5SDimitry Andric  */
1440b57cec5SDimitry Andric CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
1450b57cec5SDimitry Andric 
1460b57cec5SDimitry Andric /**
1470b57cec5SDimitry Andric  * @}
1480b57cec5SDimitry Andric  */
1490b57cec5SDimitry Andric 
150480093f4SDimitry Andric LLVM_CLANG_C_EXTERN_C_END
1510b57cec5SDimitry Andric 
1520b57cec5SDimitry Andric #endif /* CLANG_C_BUILD_SYSTEM_H */
1530b57cec5SDimitry Andric 
154