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