blob: 3cfec388308c1fb6878252cbbf80925ac1414de1 [file] [log] [blame]
Justin Bognerfb4e3f22014-05-02 22:37:02 +00001/*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +00002|* *|
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
Benjamin Kramer2f5db8b2014-08-13 16:25:19 +000014#ifndef LLVM_CLANG_C_BUILDSYSTEM_H
15#define LLVM_CLANG_C_BUILDSYSTEM_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/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000031 * Return the timestamp for use with Clang's
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +000032 * \c -fbuild-session-timestamp= option.
33 */
34CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
35
36/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000037 * Object encapsulating information about overlaying virtual
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000038 * file/directories over the real file system.
39 */
40typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
41
42/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000043 * Create a \c CXVirtualFileOverlay object.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000044 * 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/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000052 * Map an absolute virtual file path to an absolute real one.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000053 * 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/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000062 * Set the case sensitivity for the \c CXVirtualFileOverlay object.
Argyrios Kyrtzidisa9ab4d42014-03-20 04:51:48 +000063 * The \c CXVirtualFileOverlay object is case-sensitive by default, this
64 * option can be used to override the default.
65 * \returns 0 for success, non-zero to indicate an error.
66 */
67CINDEX_LINKAGE enum CXErrorCode
68clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
Fangrui Song99337e22018-07-20 08:19:20 +000069 int caseSensitive);
Argyrios Kyrtzidisa9ab4d42014-03-20 04:51:48 +000070
71/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000072 * Write out the \c CXVirtualFileOverlay object to a char buffer.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000073 *
74 * \param options is reserved, always pass 0.
Argyrios Kyrtzidis74c96c02014-03-03 06:38:52 +000075 * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
Yaron Keren45a5bfe2015-07-09 07:53:23 +000076 * disposed using \c clang_free().
Argyrios Kyrtzidis74c96c02014-03-03 06:38:52 +000077 * \param out_buffer_size pointer to receive the buffer size.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000078 * \returns 0 for success, non-zero to indicate an error.
79 */
80CINDEX_LINKAGE enum CXErrorCode
81clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
Argyrios Kyrtzidis74c96c02014-03-03 06:38:52 +000082 char **out_buffer_ptr,
83 unsigned *out_buffer_size);
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000084
85/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000086 * free memory allocated by libclang, such as the buffer returned by
Yaron Keren45a5bfe2015-07-09 07:53:23 +000087 * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
88 *
89 * \param buffer memory pointer to free.
90 */
91CINDEX_LINKAGE void clang_free(void *buffer);
92
93/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000094 * Dispose a \c CXVirtualFileOverlay object.
Argyrios Kyrtzidis0b9682e2014-02-25 03:59:23 +000095 */
96CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
97
98/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +000099 * Object encapsulating information about a module.map file.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000100 */
101typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
102
103/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000104 * Create a \c CXModuleMapDescriptor object.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000105 * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
106 *
107 * \param options is reserved, always pass 0.
108 */
109CINDEX_LINKAGE CXModuleMapDescriptor
110clang_ModuleMapDescriptor_create(unsigned options);
111
112/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000113 * Sets the framework module name that the module.map describes.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000114 * \returns 0 for success, non-zero to indicate an error.
115 */
116CINDEX_LINKAGE enum CXErrorCode
117clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
118 const char *name);
119
120/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000121 * Sets the umbrealla header name that the module.map describes.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000122 * \returns 0 for success, non-zero to indicate an error.
123 */
124CINDEX_LINKAGE enum CXErrorCode
125clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
126 const char *name);
127
128/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000129 * Write out the \c CXModuleMapDescriptor object to a char buffer.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000130 *
131 * \param options is reserved, always pass 0.
132 * \param out_buffer_ptr pointer to receive the buffer pointer, which should be
Yaron Keren45a5bfe2015-07-09 07:53:23 +0000133 * disposed using \c clang_free().
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000134 * \param out_buffer_size pointer to receive the buffer size.
135 * \returns 0 for success, non-zero to indicate an error.
136 */
137CINDEX_LINKAGE enum CXErrorCode
138clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
139 char **out_buffer_ptr,
140 unsigned *out_buffer_size);
141
142/**
Adrian Prantl9fc8faf2018-05-09 01:00:01 +0000143 * Dispose a \c CXModuleMapDescriptor object.
Argyrios Kyrtzidisd502a102014-03-03 07:41:45 +0000144 */
145CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
146
147/**
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +0000148 * @}
149 */
150
151#ifdef __cplusplus
152}
153#endif
154
Argyrios Kyrtzidis09a439d2014-02-25 03:59:16 +0000155#endif /* CLANG_C_BUILD_SYSTEM_H */
Dmitri Gribenkofdd4f302014-02-12 10:40:07 +0000156