-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Koichi Shiraishi <[email protected]>
- Loading branch information
Showing
141 changed files
with
18,500 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package clang | ||
|
||
// #include "./clang-c/Index.h" | ||
// #include "go-clang.h" | ||
import "C" | ||
import "fmt" | ||
|
||
// Represents the C++ access control level to a base class for a cursor with kind CX_CXXBaseSpecifier. | ||
type AccessSpecifier uint32 | ||
|
||
const ( | ||
AccessSpecifier_Invalid AccessSpecifier = C.CX_CXXInvalidAccessSpecifier | ||
AccessSpecifier_Public = C.CX_CXXPublic | ||
AccessSpecifier_Protected = C.CX_CXXProtected | ||
AccessSpecifier_Private = C.CX_CXXPrivate | ||
) | ||
|
||
func (as AccessSpecifier) Spelling() string { | ||
switch as { | ||
case AccessSpecifier_Invalid: | ||
return "AccessSpecifier=Invalid" | ||
case AccessSpecifier_Public: | ||
return "AccessSpecifier=Public" | ||
case AccessSpecifier_Protected: | ||
return "AccessSpecifier=Protected" | ||
case AccessSpecifier_Private: | ||
return "AccessSpecifier=Private" | ||
} | ||
|
||
return fmt.Sprintf("AccessSpecifier unknown %d", int(as)) | ||
} | ||
|
||
func (as AccessSpecifier) String() string { | ||
return as.Spelling() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package clang | ||
|
||
// #include "./clang-c/Index.h" | ||
// #include "go-clang.h" | ||
import "C" | ||
import "fmt" | ||
|
||
// Describes the availability of a particular entity, which indicates whether the use of this entity will result in a warning or error due to it being deprecated or unavailable. | ||
type AvailabilityKind uint32 | ||
|
||
const ( | ||
// The entity is available. | ||
Availability_Available AvailabilityKind = C.CXAvailability_Available | ||
// The entity is available, but has been deprecated (and its use is not recommended). | ||
Availability_Deprecated = C.CXAvailability_Deprecated | ||
// The entity is not available; any use of it will be an error. | ||
Availability_NotAvailable = C.CXAvailability_NotAvailable | ||
// The entity is available, but not accessible; any use of it will be an error. | ||
Availability_NotAccessible = C.CXAvailability_NotAccessible | ||
) | ||
|
||
func (ak AvailabilityKind) Spelling() string { | ||
switch ak { | ||
case Availability_Available: | ||
return "Availability=Available" | ||
case Availability_Deprecated: | ||
return "Availability=Deprecated" | ||
case Availability_NotAvailable: | ||
return "Availability=NotAvailable" | ||
case Availability_NotAccessible: | ||
return "Availability=NotAccessible" | ||
} | ||
|
||
return fmt.Sprintf("AvailabilityKind unknown %d", int(ak)) | ||
} | ||
|
||
func (ak AvailabilityKind) String() string { | ||
return ak.Spelling() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package clang | ||
|
||
// #include "./clang-c/Index.h" | ||
// #include "go-clang.h" | ||
import "C" | ||
import "fmt" | ||
|
||
// Describes the calling convention of a function type | ||
type CallingConv uint32 | ||
|
||
const ( | ||
CallingConv_Default CallingConv = C.CXCallingConv_Default | ||
CallingConv_C = C.CXCallingConv_C | ||
CallingConv_X86StdCall = C.CXCallingConv_X86StdCall | ||
CallingConv_X86FastCall = C.CXCallingConv_X86FastCall | ||
CallingConv_X86ThisCall = C.CXCallingConv_X86ThisCall | ||
CallingConv_X86Pascal = C.CXCallingConv_X86Pascal | ||
CallingConv_AAPCS = C.CXCallingConv_AAPCS | ||
CallingConv_AAPCS_VFP = C.CXCallingConv_AAPCS_VFP | ||
CallingConv_X86RegCall = C.CXCallingConv_X86RegCall | ||
CallingConv_IntelOclBicc = C.CXCallingConv_IntelOclBicc | ||
CallingConv_Win64 = C.CXCallingConv_Win64 | ||
CallingConv_X86_64Win64 = C.CXCallingConv_X86_64Win64 | ||
CallingConv_X86_64SysV = C.CXCallingConv_X86_64SysV | ||
CallingConv_X86VectorCall = C.CXCallingConv_X86VectorCall | ||
CallingConv_Swift = C.CXCallingConv_Swift | ||
CallingConv_PreserveMost = C.CXCallingConv_PreserveMost | ||
CallingConv_PreserveAll = C.CXCallingConv_PreserveAll | ||
CallingConv_AArch64VectorCall = C.CXCallingConv_AArch64VectorCall | ||
CallingConv_SwiftAsync = C.CXCallingConv_SwiftAsync | ||
CallingConv_Invalid = C.CXCallingConv_Invalid | ||
CallingConv_Unexposed = C.CXCallingConv_Unexposed | ||
) | ||
|
||
func (cc CallingConv) Spelling() string { | ||
switch cc { | ||
case CallingConv_Default: | ||
return "CallingConv=Default" | ||
case CallingConv_C: | ||
return "CallingConv=C" | ||
case CallingConv_X86StdCall: | ||
return "CallingConv=X86StdCall" | ||
case CallingConv_X86FastCall: | ||
return "CallingConv=X86FastCall" | ||
case CallingConv_X86ThisCall: | ||
return "CallingConv=X86ThisCall" | ||
case CallingConv_X86Pascal: | ||
return "CallingConv=X86Pascal" | ||
case CallingConv_AAPCS: | ||
return "CallingConv=AAPCS" | ||
case CallingConv_AAPCS_VFP: | ||
return "CallingConv=AAPCS_VFP" | ||
case CallingConv_X86RegCall: | ||
return "CallingConv=X86RegCall" | ||
case CallingConv_IntelOclBicc: | ||
return "CallingConv=IntelOclBicc" | ||
case CallingConv_Win64: | ||
return "CallingConv=Win64, X86_64Win64" | ||
case CallingConv_X86_64SysV: | ||
return "CallingConv=X86_64SysV" | ||
case CallingConv_X86VectorCall: | ||
return "CallingConv=X86VectorCall" | ||
case CallingConv_Swift: | ||
return "CallingConv=Swift" | ||
case CallingConv_PreserveMost: | ||
return "CallingConv=PreserveMost" | ||
case CallingConv_PreserveAll: | ||
return "CallingConv=PreserveAll" | ||
case CallingConv_AArch64VectorCall: | ||
return "CallingConv=AArch64VectorCall" | ||
case CallingConv_SwiftAsync: | ||
return "CallingConv=SwiftAsync" | ||
case CallingConv_Invalid: | ||
return "CallingConv=Invalid" | ||
case CallingConv_Unexposed: | ||
return "CallingConv=Unexposed" | ||
} | ||
|
||
return fmt.Sprintf("CallingConv unknown %d", int(cc)) | ||
} | ||
|
||
func (cc CallingConv) String() string { | ||
return cc.Spelling() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package clang | ||
|
||
// #cgo CFLAGS: -I${SRCDIR} | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build !static | ||
// +build !static | ||
|
||
package clang | ||
|
||
// #cgo LDFLAGS: -lclang | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//go:build static | ||
// +build static | ||
|
||
package clang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package clang | ||
|
||
// #include "./clang-c/Index.h" | ||
// #include "go-clang.h" | ||
import "C" | ||
import "fmt" | ||
|
||
/* | ||
Describes how the traversal of the children of a particular | ||
cursor should proceed after visiting a particular child cursor. | ||
A value of this enumeration type should be returned by each | ||
CXCursorVisitor to indicate how clang_visitChildren() proceed. | ||
*/ | ||
type ChildVisitResult uint32 | ||
|
||
const ( | ||
// Terminates the cursor traversal. | ||
ChildVisit_Break ChildVisitResult = C.CXChildVisit_Break | ||
// Continues the cursor traversal with the next sibling of the cursor just visited, without visiting its children. | ||
ChildVisit_Continue = C.CXChildVisit_Continue | ||
// Recursively traverse the children of this cursor, using the same visitor and client data. | ||
ChildVisit_Recurse = C.CXChildVisit_Recurse | ||
) | ||
|
||
func (cvr ChildVisitResult) Spelling() string { | ||
switch cvr { | ||
case ChildVisit_Break: | ||
return "ChildVisit=Break" | ||
case ChildVisit_Continue: | ||
return "ChildVisit=Continue" | ||
case ChildVisit_Recurse: | ||
return "ChildVisit=Recurse" | ||
} | ||
|
||
return fmt.Sprintf("ChildVisitResult unknown %d", int(cvr)) | ||
} | ||
|
||
func (cvr ChildVisitResult) String() string { | ||
return cvr.Spelling() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#include <stdint.h> | ||
|
||
/*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\ | ||
|* *| | ||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| | ||
|* Exceptions. *| | ||
|* See https://llvm.org/LICENSE.txt for license information. *| | ||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| | ||
|* *| | ||
|*===----------------------------------------------------------------------===*| | ||
|* *| | ||
|* This header provides various utilities for use by build systems. *| | ||
|* *| | ||
\*===----------------------------------------------------------------------===*/ | ||
|
||
#ifndef LLVM_CLANG_C_BUILDSYSTEM_H | ||
#define LLVM_CLANG_C_BUILDSYSTEM_H | ||
|
||
#include "clang-c/CXErrorCode.h" | ||
#include "clang-c/CXString.h" | ||
#include "clang-c/ExternC.h" | ||
#include "clang-c/Platform.h" | ||
|
||
LLVM_CLANG_C_EXTERN_C_BEGIN | ||
|
||
/** | ||
* \defgroup BUILD_SYSTEM Build system utilities | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* Return the timestamp for use with Clang's | ||
* \c -fbuild-session-timestamp= option. | ||
*/ | ||
CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void); | ||
|
||
/** | ||
* Object encapsulating information about overlaying virtual | ||
* file/directories over the real file system. | ||
*/ | ||
typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay; | ||
|
||
/** | ||
* 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); | ||
|
||
/** | ||
* 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); | ||
|
||
/** | ||
* 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); | ||
|
||
/** | ||
* 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 | ||
* disposed using \c clang_free(). | ||
* \param out_buffer_size pointer to receive the buffer size. | ||
* \returns 0 for success, non-zero to indicate an error. | ||
*/ | ||
CINDEX_LINKAGE enum CXErrorCode | ||
clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options, | ||
char **out_buffer_ptr, | ||
unsigned *out_buffer_size); | ||
|
||
/** | ||
* 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); | ||
|
||
/** | ||
* Dispose a \c CXVirtualFileOverlay object. | ||
*/ | ||
CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay); | ||
|
||
/** | ||
* Object encapsulating information about a module.map file. | ||
*/ | ||
typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor; | ||
|
||
/** | ||
* Create a \c CXModuleMapDescriptor object. | ||
* Must be disposed with \c clang_ModuleMapDescriptor_dispose(). | ||
* | ||
* \param options is reserved, always pass 0. | ||
*/ | ||
CINDEX_LINKAGE CXModuleMapDescriptor | ||
clang_ModuleMapDescriptor_create(unsigned options); | ||
|
||
/** | ||
* 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); | ||
|
||
/** | ||
* Sets the umbrella 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); | ||
|
||
/** | ||
* 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 | ||
* disposed using \c clang_free(). | ||
* \param out_buffer_size pointer to receive the buffer size. | ||
* \returns 0 for success, non-zero to indicate an error. | ||
*/ | ||
CINDEX_LINKAGE enum CXErrorCode | ||
clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options, | ||
char **out_buffer_ptr, | ||
unsigned *out_buffer_size); | ||
|
||
/** | ||
* Dispose a \c CXModuleMapDescriptor object. | ||
*/ | ||
CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor); | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
LLVM_CLANG_C_EXTERN_C_END | ||
|
||
#endif /* CLANG_C_BUILD_SYSTEM_H */ | ||
|
Oops, something went wrong.