blob: 3d65c536f5a53124d60c3508cbf2a16bd398963e [file] [log] [blame]
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +00001/*==-- clang-c/BuildSysetm.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
Argyrios Kyrtzidis09a439d2014-02-25 03:59:16 +000014#ifndef CLANG_C_BUILD_SYSTEM_H
15#define CLANG_C_BUILD_SYSTEM_H
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +000016
17#include "clang-c/Platform.h"
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000018#include "clang-c/CXErrorCode.h"
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +000019#include "clang-c/CXString.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/**
26 * \defgroup BUILD_SYSTEM Build system utilities
27 * @{
28 */
29
30/**
31 * \brief Return the timestamp for use with Clang's
32 * \c -fbuild-session-timestamp= option.
33 */
34CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
35
36/**
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000037 * \brief Object encapsulating information about overlaying virtual
38 * file/directories over the real file system.
39 */
40typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
41
42/**
43 * \brief Create a \c CXVirtualFileOverlay object.
44 * Must be disposed with \c clang_VirtualFileOverlay_dispose().
45 *
46 * \param options is reserved, always pass 0.
47 */
48CINDEX_LINKAGE CXVirtualFileOverlay
49clang_VirtualFileOverlay_create(unsigned options);
50
51/**
52 * \brief Map an absolute virtual file path to an absolute real one.
53 * The virtual path must be canonicalized (not contain "."/"..").
54 * \returns 0 for success, non-zero to indicate an error.
55 */
56CINDEX_LINKAGE enum CXErrorCode
57clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
58 const char *virtualPath,
59 const char *realPath);
60
61/**
62 * \brief Write out the \c CXVirtualFileOverlay object to a char buffer.
63 *
64 * \param options is reserved, always pass 0.
Argyrios Kyrtzidis74c96c02014-03-03 06:38:52 +000065 * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
66 * disposed using \c free().
67 * \param out_buffer_size pointer to receive the buffer size.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000068 * \returns 0 for success, non-zero to indicate an error.
69 */
70CINDEX_LINKAGE enum CXErrorCode
71clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
Argyrios Kyrtzidis74c96c02014-03-03 06:38:52 +000072 char **out_buffer_ptr,
73 unsigned *out_buffer_size);
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000074
75/**
76 * \brief Dispose a \c CXVirtualFileOverlay object.
77 */
78CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
79
80/**
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +000081 * \brief Object encapsulating information about a module.map file.
82 */
83typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
84
85/**
86 * \brief Create a \c CXModuleMapDescriptor object.
87 * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
88 *
89 * \param options is reserved, always pass 0.
90 */
91CINDEX_LINKAGE CXModuleMapDescriptor
92clang_ModuleMapDescriptor_create(unsigned options);
93
94/**
95 * \brief Sets the framework module name that the module.map describes.
96 * \returns 0 for success, non-zero to indicate an error.
97 */
98CINDEX_LINKAGE enum CXErrorCode
99clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
100 const char *name);
101
102/**
103 * \brief Sets the umbrealla header name that the module.map describes.
104 * \returns 0 for success, non-zero to indicate an error.
105 */
106CINDEX_LINKAGE enum CXErrorCode
107clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
108 const char *name);
109
110/**
111 * \brief Write out the \c CXModuleMapDescriptor object to a char buffer.
112 *
113 * \param options is reserved, always pass 0.
114 * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
115 * disposed using \c free().
116 * \param out_buffer_size pointer to receive the buffer size.
117 * \returns 0 for success, non-zero to indicate an error.
118 */
119CINDEX_LINKAGE enum CXErrorCode
120clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
121 char **out_buffer_ptr,
122 unsigned *out_buffer_size);
123
124/**
125 * \brief Dispose a \c CXModuleMapDescriptor object.
126 */
127CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
128
129/**
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +0000130 * @}
131 */
132
133#ifdef __cplusplus
134}
135#endif
136
Argyrios Kyrtzidis09a439d2014-02-25 03:59:16 +0000137#endif /* CLANG_C_BUILD_SYSTEM_H */
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +0000138