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