clang  19.0.0git
BuildSystem.h
Go to the documentation of this file.
1 /*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
2 |* *|
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 *|
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 
17 #include "clang-c/CXErrorCode.h"
18 #include "clang-c/CXString.h"
19 #include "clang-c/ExternC.h"
20 #include "clang-c/Platform.h"
21 
23 
24 /**
25  * \defgroup BUILD_SYSTEM Build system utilities
26  * @{
27  */
28 
29 /**
30  * Return the timestamp for use with Clang's
31  * \c -fbuild-session-timestamp= option.
32  */
34 
35 /**
36  * Object encapsulating information about overlaying virtual
37  * file/directories over the real file system.
38  */
39 typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
40 
41 /**
42  * Create a \c CXVirtualFileOverlay object.
43  * Must be disposed with \c clang_VirtualFileOverlay_dispose().
44  *
45  * \param options is reserved, always pass 0.
46  */
49 
50 /**
51  * Map an absolute virtual file path to an absolute real one.
52  * The virtual path must be canonicalized (not contain "."/"..").
53  * \returns 0 for success, non-zero to indicate an error.
54  */
57  const char *virtualPath,
58  const char *realPath);
59 
60 /**
61  * Set the case sensitivity for the \c CXVirtualFileOverlay object.
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  */
68  int caseSensitive);
69 
70 /**
71  * Write out the \c CXVirtualFileOverlay object to a char buffer.
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  */
81  char **out_buffer_ptr,
82  unsigned *out_buffer_size);
83 
84 /**
85  * free memory allocated by libclang, such as the buffer returned by
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 /**
93  * Dispose a \c CXVirtualFileOverlay object.
94  */
96 
97 /**
98  * Object encapsulating information about a module.modulemap file.
99  */
100 typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
101 
102 /**
103  * Create a \c CXModuleMapDescriptor object.
104  * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
105  *
106  * \param options is reserved, always pass 0.
107  */
110 
111 /**
112  * Sets the framework module name that the module.modulemap describes.
113  * \returns 0 for success, non-zero to indicate an error.
114  */
117  const char *name);
118 
119 /**
120  * Sets the umbrella header name that the module.modulemap describes.
121  * \returns 0 for success, non-zero to indicate an error.
122  */
125  const char *name);
126 
127 /**
128  * Write out the \c CXModuleMapDescriptor object to a char buffer.
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  */
138  char **out_buffer_ptr,
139  unsigned *out_buffer_size);
140 
141 /**
142  * Dispose a \c CXModuleMapDescriptor object.
143  */
145 
146 /**
147  * @}
148  */
149 
151 
152 #endif /* CLANG_C_BUILD_SYSTEM_H */
153 
CXErrorCode
Error codes returned by libclang routines.
Definition: CXErrorCode.h:28
#define LLVM_CLANG_C_EXTERN_C_END
Definition: ExternC.h:36
#define LLVM_CLANG_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define CINDEX_LINKAGE
Definition: Platform.h:38
CINDEX_LINKAGE enum CXErrorCode clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay, int caseSensitive)
Set the case sensitivity for the CXVirtualFileOverlay object.
CINDEX_LINKAGE enum CXErrorCode clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options, char **out_buffer_ptr, unsigned *out_buffer_size)
Write out the CXVirtualFileOverlay object to a char buffer.
CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay)
Dispose a CXVirtualFileOverlay object.
CINDEX_LINKAGE void clang_free(void *buffer)
free memory allocated by libclang, such as the buffer returned by CXVirtualFileOverlay() or clang_Mod...
CINDEX_LINKAGE CXModuleMapDescriptor clang_ModuleMapDescriptor_create(unsigned options)
Create a CXModuleMapDescriptor object.
CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void)
Return the timestamp for use with Clang's -fbuild-session-timestamp= option.
CINDEX_LINKAGE enum CXErrorCode clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor, const char *name)
Sets the umbrella header name that the module.modulemap describes.
struct CXModuleMapDescriptorImpl * CXModuleMapDescriptor
Object encapsulating information about a module.modulemap file.
Definition: BuildSystem.h:100
CINDEX_LINKAGE enum CXErrorCode clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor, const char *name)
Sets the framework module name that the module.modulemap describes.
CINDEX_LINKAGE enum CXErrorCode clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay, const char *virtualPath, const char *realPath)
Map an absolute virtual file path to an absolute real one.
CINDEX_LINKAGE CXVirtualFileOverlay clang_VirtualFileOverlay_create(unsigned options)
Create a CXVirtualFileOverlay object.
CINDEX_LINKAGE enum CXErrorCode clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options, char **out_buffer_ptr, unsigned *out_buffer_size)
Write out the CXModuleMapDescriptor object to a char buffer.
CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor)
Dispose a CXModuleMapDescriptor object.
struct CXVirtualFileOverlayImpl * CXVirtualFileOverlay
Object encapsulating information about overlaying virtual file/directories over the real file system.
Definition: BuildSystem.h:39
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...