diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-02-25 03:59:23 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-02-25 03:59:23 +0000 |
commit | 0b9682efa42cbd2c3d4ee5cfd56b22f590aeaa8a (patch) | |
tree | 77866ecdcefdb675fc2e5559fbe799209b8c3ac6 /clang/include/clang-c | |
parent | 09a439d3135d276a1b8b35bc50ff9603cb0f2755 (diff) | |
download | bcm5719-llvm-0b9682efa42cbd2c3d4ee5cfd56b22f590aeaa8a.tar.gz bcm5719-llvm-0b9682efa42cbd2c3d4ee5cfd56b22f590aeaa8a.zip |
[libclang] Introduce libclang APIs for creating a buffer with a JSON virtual file overlay description.
The current API only supports adding 'virtual file path' -> 'real file path' mappings.
rdar://15986708
llvm-svn: 202105
Diffstat (limited to 'clang/include/clang-c')
-rw-r--r-- | clang/include/clang-c/BuildSystem.h | 43 | ||||
-rw-r--r-- | clang/include/clang-c/CXErrorCode.h | 64 | ||||
-rw-r--r-- | clang/include/clang-c/Index.h | 40 |
3 files changed, 109 insertions, 38 deletions
diff --git a/clang/include/clang-c/BuildSystem.h b/clang/include/clang-c/BuildSystem.h index f8eff4257df..ab581fdcced 100644 --- a/clang/include/clang-c/BuildSystem.h +++ b/clang/include/clang-c/BuildSystem.h @@ -15,6 +15,7 @@ #define CLANG_C_BUILD_SYSTEM_H #include "clang-c/Platform.h" +#include "clang-c/CXErrorCode.h" #include "clang-c/CXString.h" #ifdef __cplusplus @@ -33,6 +34,48 @@ extern "C" { CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void); /** + * \brief Object encapsulating information about overlaying virtual + * file/directories over the real file system. + */ +typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay; + +/** + * \brief Create a \c CXVirtualFileOverlay object. + * Must be disposed with \c clang_VirtualFileOverlay_dispose(). + * + * \param options is reserved, always pass 0. + */ +CINDEX_LINKAGE CXVirtualFileOverlay +clang_VirtualFileOverlay_create(unsigned options); + +/** + * \brief Map an absolute virtual file path to an absolute real one. + * The virtual path must be canonicalized (not contain "."/".."). + * \returns 0 for success, non-zero to indicate an error. + */ +CINDEX_LINKAGE enum CXErrorCode +clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay, + const char *virtualPath, + const char *realPath); + +/** + * \brief Write out the \c CXVirtualFileOverlay object to a char buffer. + * + * \param options is reserved, always pass 0. + * \param out_buffer pointer to receive the CXString object, which should be + * disposed using \c clang_disposeString(). + * \returns 0 for success, non-zero to indicate an error. + */ +CINDEX_LINKAGE enum CXErrorCode +clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options, + CXString *out_buffer); + +/** + * \brief Dispose a \c CXVirtualFileOverlay object. + */ +CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay); + +/** * @} */ diff --git a/clang/include/clang-c/CXErrorCode.h b/clang/include/clang-c/CXErrorCode.h new file mode 100644 index 00000000000..a026c95a5bb --- /dev/null +++ b/clang/include/clang-c/CXErrorCode.h @@ -0,0 +1,64 @@ +/*===-- clang-c/CXErrorCode.h - C Index Error Codes --------------*- C -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file is distributed under the University of Illinois Open Source *| +|* License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This header provides the CXErrorCode enumerators. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef CLANG_C_CXERRORCODE_H +#define CLANG_C_CXERRORCODE_H + +#include "clang-c/Platform.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Error codes returned by libclang routines. + * + * Zero (\c CXError_Success) is the only error code indicating success. Other + * error codes, including not yet assigned non-zero values, indicate errors. + */ +enum CXErrorCode { + /** + * \brief No error. + */ + CXError_Success = 0, + + /** + * \brief A generic error code, no further details are available. + * + * Errors of this kind can get their own specific error codes in future + * libclang versions. + */ + CXError_Failure = 1, + + /** + * \brief libclang crashed while performing the requested operation. + */ + CXError_Crashed = 2, + + /** + * \brief The function detected that the arguments violate the function + * contract. + */ + CXError_InvalidArguments = 3, + + /** + * \brief An AST deserialization error has occurred. + */ + CXError_ASTReadError = 4 +}; + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index eece5fb9756..9c37ac745bb 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -19,6 +19,7 @@ #include <time.h> #include "clang-c/Platform.h" +#include "clang-c/CXErrorCode.h" #include "clang-c/CXString.h" #include "clang-c/BuildSystem.h" @@ -31,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 23 +#define CINDEX_VERSION_MINOR 24 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -74,43 +75,6 @@ extern "C" { */ /** - * \brief Error codes returned by libclang routines. - * - * Zero (\c CXError_Success) is the only error code indicating success. Other - * error codes, including not yet assigned non-zero values, indicate errors. - */ -enum CXErrorCode { - /** - * \brief No error. - */ - CXError_Success = 0, - - /** - * \brief A generic error code, no further details are available. - * - * Errors of this kind can get their own specific error codes in future - * libclang versions. - */ - CXError_Failure = 1, - - /** - * \brief libclang crashed while performing the requested operation. - */ - CXError_Crashed = 2, - - /** - * \brief The function detected that the arguments violate the function - * contract. - */ - CXError_InvalidArguments = 3, - - /** - * \brief An AST deserialization error has occurred. - */ - CXError_ASTReadError = 4 -}; - -/** * \brief An "index" that consists of a set of translation units that would * typically be linked together into an executable or library. */ |