Skip to content

Commit

Permalink
clang: update to clang v7
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Nov 17, 2021
1 parent 0e8790f commit 87ea4b7
Show file tree
Hide file tree
Showing 23 changed files with 1,533 additions and 918 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "main"

env:
LLVM_VERSION: 6
LLVM_VERSION: 7

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export CC := clang
export CXX := clang++

LLVM_LIBDIR?=$(shell llvm-config --libdir)
LLVM_VERSION?=6
LLVM_VERSION?=7

all: test

Expand Down
30 changes: 15 additions & 15 deletions clang/clang-c/BuildSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ extern "C" {
*/

/**
* \brief Return the timestamp for use with Clang's
* Return the timestamp for use with Clang's
* \c -fbuild-session-timestamp= option.
*/
CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);

/**
* \brief Object encapsulating information about overlaying virtual
* Object encapsulating information about overlaying virtual
* file/directories over the real file system.
*/
typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;

/**
* \brief Create a \c CXVirtualFileOverlay object.
* Create a \c CXVirtualFileOverlay object.
* Must be disposed with \c clang_VirtualFileOverlay_dispose().
*
* \param options is reserved, always pass 0.
Expand All @@ -51,7 +51,7 @@ CINDEX_LINKAGE CXVirtualFileOverlay
clang_VirtualFileOverlay_create(unsigned options);

/**
* \brief Map an absolute virtual file path to an absolute real one.
* 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.
*/
Expand All @@ -61,17 +61,17 @@ clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
const char *realPath);

/**
* \brief Set the case sensitivity for the \c CXVirtualFileOverlay object.
* Set the case sensitivity for the \c CXVirtualFileOverlay object.
* The \c CXVirtualFileOverlay object is case-sensitive by default, this
* option can be used to override the default.
* \returns 0 for success, non-zero to indicate an error.
*/
CINDEX_LINKAGE enum CXErrorCode
clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
int caseSensitive);
int caseSensitive);

/**
* \brief Write out the \c CXVirtualFileOverlay object to a char buffer.
* Write out the \c CXVirtualFileOverlay object to a char buffer.
*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
Expand All @@ -85,25 +85,25 @@ clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
unsigned *out_buffer_size);

/**
* \brief free memory allocated by libclang, such as the buffer returned by
* free memory allocated by libclang, such as the buffer returned by
* \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
*
* \param buffer memory pointer to free.
*/
CINDEX_LINKAGE void clang_free(void *buffer);

/**
* \brief Dispose a \c CXVirtualFileOverlay object.
* Dispose a \c CXVirtualFileOverlay object.
*/
CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);

/**
* \brief Object encapsulating information about a module.map file.
* Object encapsulating information about a module.map file.
*/
typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;

/**
* \brief Create a \c CXModuleMapDescriptor object.
* Create a \c CXModuleMapDescriptor object.
* Must be disposed with \c clang_ModuleMapDescriptor_dispose().
*
* \param options is reserved, always pass 0.
Expand All @@ -112,23 +112,23 @@ CINDEX_LINKAGE CXModuleMapDescriptor
clang_ModuleMapDescriptor_create(unsigned options);

/**
* \brief Sets the framework module name that the module.map describes.
* Sets the framework module name that the module.map describes.
* \returns 0 for success, non-zero to indicate an error.
*/
CINDEX_LINKAGE enum CXErrorCode
clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
const char *name);

/**
* \brief Sets the umbrealla header name that the module.map describes.
* Sets the umbrealla header name that the module.map describes.
* \returns 0 for success, non-zero to indicate an error.
*/
CINDEX_LINKAGE enum CXErrorCode
clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
const char *name);

/**
* \brief Write out the \c CXModuleMapDescriptor object to a char buffer.
* Write out the \c CXModuleMapDescriptor object to a char buffer.
*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
Expand All @@ -142,7 +142,7 @@ clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
unsigned *out_buffer_size);

/**
* \brief Dispose a \c CXModuleMapDescriptor object.
* Dispose a \c CXModuleMapDescriptor object.
*/
CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);

Expand Down
38 changes: 19 additions & 19 deletions clang/clang-c/CXCompilationDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C" {
typedef void * CXCompilationDatabase;

/**
* \brief Contains the results of a search in the compilation database
* Contains the results of a search in the compilation database
*
* When searching for the compile command for a file, the compilation db can
* return several commands, as the file may have been compiled with
Expand All @@ -51,28 +51,28 @@ typedef void * CXCompilationDatabase;
typedef void * CXCompileCommands;

/**
* \brief Represents the command line invocation to compile a specific file.
* Represents the command line invocation to compile a specific file.
*/
typedef void * CXCompileCommand;

/**
* \brief Error codes for Compilation Database
* Error codes for Compilation Database
*/
typedef enum {
/*
* \brief No error occurred
* No error occurred
*/
CXCompilationDatabase_NoError = 0,

/*
* \brief Database can not be loaded
* Database can not be loaded
*/
CXCompilationDatabase_CanNotLoadDatabase = 1

} CXCompilationDatabase_Error;

/**
* \brief Creates a compilation database from the database found in directory
* Creates a compilation database from the database found in directory
* buildDir. For example, CMake can output a compile_commands.json which can
* be used to build the database.
*
Expand All @@ -83,65 +83,65 @@ clang_CompilationDatabase_fromDirectory(const char *BuildDir,
CXCompilationDatabase_Error *ErrorCode);

/**
* \brief Free the given compilation database
* Free the given compilation database
*/
CINDEX_LINKAGE void
clang_CompilationDatabase_dispose(CXCompilationDatabase);

/**
* \brief Find the compile commands used for a file. The compile commands
* Find the compile commands used for a file. The compile commands
* must be freed by \c clang_CompileCommands_dispose.
*/
CINDEX_LINKAGE CXCompileCommands
clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase,
const char *CompleteFileName);

/**
* \brief Get all the compile commands in the given compilation database.
* Get all the compile commands in the given compilation database.
*/
CINDEX_LINKAGE CXCompileCommands
clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase);

/**
* \brief Free the given CompileCommands
* Free the given CompileCommands
*/
CINDEX_LINKAGE void clang_CompileCommands_dispose(CXCompileCommands);

/**
* \brief Get the number of CompileCommand we have for a file
* Get the number of CompileCommand we have for a file
*/
CINDEX_LINKAGE unsigned
clang_CompileCommands_getSize(CXCompileCommands);

/**
* \brief Get the I'th CompileCommand for a file
* Get the I'th CompileCommand for a file
*
* Note : 0 <= i < clang_CompileCommands_getSize(CXCompileCommands)
*/
CINDEX_LINKAGE CXCompileCommand
clang_CompileCommands_getCommand(CXCompileCommands, unsigned I);

/**
* \brief Get the working directory where the CompileCommand was executed from
* Get the working directory where the CompileCommand was executed from
*/
CINDEX_LINKAGE CXString
clang_CompileCommand_getDirectory(CXCompileCommand);

/**
* \brief Get the filename associated with the CompileCommand.
* Get the filename associated with the CompileCommand.
*/
CINDEX_LINKAGE CXString
clang_CompileCommand_getFilename(CXCompileCommand);

/**
* \brief Get the number of arguments in the compiler invocation.
* Get the number of arguments in the compiler invocation.
*
*/
CINDEX_LINKAGE unsigned
clang_CompileCommand_getNumArgs(CXCompileCommand);

/**
* \brief Get the I'th argument value in the compiler invocations
* Get the I'th argument value in the compiler invocations
*
* Invariant :
* - argument 0 is the compiler executable
Expand All @@ -150,19 +150,19 @@ CINDEX_LINKAGE CXString
clang_CompileCommand_getArg(CXCompileCommand, unsigned I);

/**
* \brief Get the number of source mappings for the compiler invocation.
* Get the number of source mappings for the compiler invocation.
*/
CINDEX_LINKAGE unsigned
clang_CompileCommand_getNumMappedSources(CXCompileCommand);

/**
* \brief Get the I'th mapped source path for the compiler invocation.
* Get the I'th mapped source path for the compiler invocation.
*/
CINDEX_LINKAGE CXString
clang_CompileCommand_getMappedSourcePath(CXCompileCommand, unsigned I);

/**
* \brief Get the I'th mapped source content for the compiler invocation.
* Get the I'th mapped source content for the compiler invocation.
*/
CINDEX_LINKAGE CXString
clang_CompileCommand_getMappedSourceContent(CXCompileCommand, unsigned I);
Expand Down
12 changes: 6 additions & 6 deletions clang/clang-c/CXErrorCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ extern "C" {
#endif

/**
* \brief Error codes returned by libclang routines.
* 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.
* No error.
*/
CXError_Success = 0,

/**
* \brief A generic error code, no further details are available.
* 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.
* libclang crashed while performing the requested operation.
*/
CXError_Crashed = 2,

/**
* \brief The function detected that the arguments violate the function
* The function detected that the arguments violate the function
* contract.
*/
CXError_InvalidArguments = 3,

/**
* \brief An AST deserialization error has occurred.
* An AST deserialization error has occurred.
*/
CXError_ASTReadError = 4
};
Expand Down
8 changes: 4 additions & 4 deletions clang/clang-c/CXString.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern "C" {
*/

/**
* \brief A character string.
* A character string.
*
* The \c CXString type is used to return strings from the interface when
* the ownership of that string might differ from one call to the next.
Expand All @@ -48,17 +48,17 @@ typedef struct {
} CXStringSet;

/**
* \brief Retrieve the character data associated with the given string.
* Retrieve the character data associated with the given string.
*/
CINDEX_LINKAGE const char *clang_getCString(CXString string);

/**
* \brief Free the given string.
* Free the given string.
*/
CINDEX_LINKAGE void clang_disposeString(CXString string);

/**
* \brief Free the given string set.
* Free the given string set.
*/
CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set);

Expand Down
Loading

0 comments on commit 87ea4b7

Please sign in to comment.