xref: /netbsd-src/external/apache2/llvm/dist/clang/include/clang-c/BuildSystem.h (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
17330f729Sjoerg /*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
27330f729Sjoerg |*                                                                            *|
37330f729Sjoerg |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
47330f729Sjoerg |* Exceptions.                                                                *|
57330f729Sjoerg |* See https://llvm.org/LICENSE.txt for license information.                  *|
67330f729Sjoerg |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
77330f729Sjoerg |*                                                                            *|
87330f729Sjoerg |*===----------------------------------------------------------------------===*|
97330f729Sjoerg |*                                                                            *|
107330f729Sjoerg |* This header provides various utilities for use by build systems.           *|
117330f729Sjoerg |*                                                                            *|
127330f729Sjoerg \*===----------------------------------------------------------------------===*/
137330f729Sjoerg 
147330f729Sjoerg #ifndef LLVM_CLANG_C_BUILDSYSTEM_H
157330f729Sjoerg #define LLVM_CLANG_C_BUILDSYSTEM_H
167330f729Sjoerg 
177330f729Sjoerg #include "clang-c/CXErrorCode.h"
187330f729Sjoerg #include "clang-c/CXString.h"
19*e038c9c4Sjoerg #include "clang-c/ExternC.h"
20*e038c9c4Sjoerg #include "clang-c/Platform.h"
217330f729Sjoerg 
22*e038c9c4Sjoerg LLVM_CLANG_C_EXTERN_C_BEGIN
237330f729Sjoerg 
247330f729Sjoerg /**
257330f729Sjoerg  * \defgroup BUILD_SYSTEM Build system utilities
267330f729Sjoerg  * @{
277330f729Sjoerg  */
287330f729Sjoerg 
297330f729Sjoerg /**
307330f729Sjoerg  * Return the timestamp for use with Clang's
317330f729Sjoerg  * \c -fbuild-session-timestamp= option.
327330f729Sjoerg  */
337330f729Sjoerg CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
347330f729Sjoerg 
357330f729Sjoerg /**
367330f729Sjoerg  * Object encapsulating information about overlaying virtual
377330f729Sjoerg  * file/directories over the real file system.
387330f729Sjoerg  */
397330f729Sjoerg typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
407330f729Sjoerg 
417330f729Sjoerg /**
427330f729Sjoerg  * Create a \c CXVirtualFileOverlay object.
437330f729Sjoerg  * Must be disposed with \c clang_VirtualFileOverlay_dispose().
447330f729Sjoerg  *
457330f729Sjoerg  * \param options is reserved, always pass 0.
467330f729Sjoerg  */
477330f729Sjoerg CINDEX_LINKAGE CXVirtualFileOverlay
487330f729Sjoerg clang_VirtualFileOverlay_create(unsigned options);
497330f729Sjoerg 
507330f729Sjoerg /**
517330f729Sjoerg  * Map an absolute virtual file path to an absolute real one.
527330f729Sjoerg  * The virtual path must be canonicalized (not contain "."/"..").
537330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
547330f729Sjoerg  */
557330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
567330f729Sjoerg clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
577330f729Sjoerg                                         const char *virtualPath,
587330f729Sjoerg                                         const char *realPath);
597330f729Sjoerg 
607330f729Sjoerg /**
617330f729Sjoerg  * Set the case sensitivity for the \c CXVirtualFileOverlay object.
627330f729Sjoerg  * The \c CXVirtualFileOverlay object is case-sensitive by default, this
637330f729Sjoerg  * option can be used to override the default.
647330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
657330f729Sjoerg  */
667330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
677330f729Sjoerg clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
687330f729Sjoerg                                             int caseSensitive);
697330f729Sjoerg 
707330f729Sjoerg /**
717330f729Sjoerg  * Write out the \c CXVirtualFileOverlay object to a char buffer.
727330f729Sjoerg  *
737330f729Sjoerg  * \param options is reserved, always pass 0.
747330f729Sjoerg  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
757330f729Sjoerg  * disposed using \c clang_free().
767330f729Sjoerg  * \param out_buffer_size pointer to receive the buffer size.
777330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
787330f729Sjoerg  */
797330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
807330f729Sjoerg clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
817330f729Sjoerg                                        char **out_buffer_ptr,
827330f729Sjoerg                                        unsigned *out_buffer_size);
837330f729Sjoerg 
847330f729Sjoerg /**
857330f729Sjoerg  * free memory allocated by libclang, such as the buffer returned by
867330f729Sjoerg  * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
877330f729Sjoerg  *
887330f729Sjoerg  * \param buffer memory pointer to free.
897330f729Sjoerg  */
907330f729Sjoerg CINDEX_LINKAGE void clang_free(void *buffer);
917330f729Sjoerg 
927330f729Sjoerg /**
937330f729Sjoerg  * Dispose a \c CXVirtualFileOverlay object.
947330f729Sjoerg  */
957330f729Sjoerg CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
967330f729Sjoerg 
977330f729Sjoerg /**
987330f729Sjoerg  * Object encapsulating information about a module.map file.
997330f729Sjoerg  */
1007330f729Sjoerg typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
1017330f729Sjoerg 
1027330f729Sjoerg /**
1037330f729Sjoerg  * Create a \c CXModuleMapDescriptor object.
1047330f729Sjoerg  * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
1057330f729Sjoerg  *
1067330f729Sjoerg  * \param options is reserved, always pass 0.
1077330f729Sjoerg  */
1087330f729Sjoerg CINDEX_LINKAGE CXModuleMapDescriptor
1097330f729Sjoerg clang_ModuleMapDescriptor_create(unsigned options);
1107330f729Sjoerg 
1117330f729Sjoerg /**
1127330f729Sjoerg  * Sets the framework module name that the module.map describes.
1137330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
1147330f729Sjoerg  */
1157330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
1167330f729Sjoerg clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
1177330f729Sjoerg                                                  const char *name);
1187330f729Sjoerg 
1197330f729Sjoerg /**
120*e038c9c4Sjoerg  * Sets the umbrella header name that the module.map describes.
1217330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
1227330f729Sjoerg  */
1237330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
1247330f729Sjoerg clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
1257330f729Sjoerg                                             const char *name);
1267330f729Sjoerg 
1277330f729Sjoerg /**
1287330f729Sjoerg  * Write out the \c CXModuleMapDescriptor object to a char buffer.
1297330f729Sjoerg  *
1307330f729Sjoerg  * \param options is reserved, always pass 0.
1317330f729Sjoerg  * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
1327330f729Sjoerg  * disposed using \c clang_free().
1337330f729Sjoerg  * \param out_buffer_size pointer to receive the buffer size.
1347330f729Sjoerg  * \returns 0 for success, non-zero to indicate an error.
1357330f729Sjoerg  */
1367330f729Sjoerg CINDEX_LINKAGE enum CXErrorCode
1377330f729Sjoerg clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
1387330f729Sjoerg                                        char **out_buffer_ptr,
1397330f729Sjoerg                                        unsigned *out_buffer_size);
1407330f729Sjoerg 
1417330f729Sjoerg /**
1427330f729Sjoerg  * Dispose a \c CXModuleMapDescriptor object.
1437330f729Sjoerg  */
1447330f729Sjoerg CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
1457330f729Sjoerg 
1467330f729Sjoerg /**
1477330f729Sjoerg  * @}
1487330f729Sjoerg  */
1497330f729Sjoerg 
150*e038c9c4Sjoerg LLVM_CLANG_C_EXTERN_C_END
1517330f729Sjoerg 
1527330f729Sjoerg #endif /* CLANG_C_BUILD_SYSTEM_H */
1537330f729Sjoerg 
154