Skip to content

Commit ee3102f

Browse files
committed
clang: generate clang v15 binding
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent e5acabd commit ee3102f

File tree

141 files changed

+17878
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+17878
-0
lines changed

clang/accessspecifier_gen.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package clang
2+
3+
// #include "./clang-c/Index.h"
4+
// #include "go-clang.h"
5+
import "C"
6+
import "fmt"
7+
8+
// AccessSpecifier represents the C++ access control level to a base class for a cursor with kind CX_CXXBaseSpecifier.
9+
type AccessSpecifier uint32
10+
11+
const (
12+
AccessSpecifier_Invalid AccessSpecifier = C.CX_CXXInvalidAccessSpecifier
13+
AccessSpecifier_Public = C.CX_CXXPublic
14+
AccessSpecifier_Protected = C.CX_CXXProtected
15+
AccessSpecifier_Private = C.CX_CXXPrivate
16+
)
17+
18+
func (as AccessSpecifier) Spelling() string {
19+
switch as {
20+
case AccessSpecifier_Invalid:
21+
return "AccessSpecifier=Invalid"
22+
case AccessSpecifier_Public:
23+
return "AccessSpecifier=Public"
24+
case AccessSpecifier_Protected:
25+
return "AccessSpecifier=Protected"
26+
case AccessSpecifier_Private:
27+
return "AccessSpecifier=Private"
28+
}
29+
30+
return fmt.Sprintf("AccessSpecifier unknown %d", int(as))
31+
}
32+
33+
func (as AccessSpecifier) String() string {
34+
return as.Spelling()
35+
}

clang/availabilitykind_gen.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package clang
2+
3+
// #include "./clang-c/Index.h"
4+
// #include "go-clang.h"
5+
import "C"
6+
import "fmt"
7+
8+
// AvailabilityKind 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.
9+
type AvailabilityKind uint32
10+
11+
const (
12+
// Availability_Available the entity is available.
13+
Availability_Available AvailabilityKind = C.CXAvailability_Available
14+
// Availability_Deprecated the entity is available, but has been deprecated (and its use is not recommended).
15+
Availability_Deprecated = C.CXAvailability_Deprecated
16+
// Availability_NotAvailable the entity is not available; any use of it will be an error.
17+
Availability_NotAvailable = C.CXAvailability_NotAvailable
18+
// Availability_NotAccessible the entity is available, but not accessible; any use of it will be an error.
19+
Availability_NotAccessible = C.CXAvailability_NotAccessible
20+
)
21+
22+
func (ak AvailabilityKind) Spelling() string {
23+
switch ak {
24+
case Availability_Available:
25+
return "Availability=Available"
26+
case Availability_Deprecated:
27+
return "Availability=Deprecated"
28+
case Availability_NotAvailable:
29+
return "Availability=NotAvailable"
30+
case Availability_NotAccessible:
31+
return "Availability=NotAccessible"
32+
}
33+
34+
return fmt.Sprintf("AvailabilityKind unknown %d", int(ak))
35+
}
36+
37+
func (ak AvailabilityKind) String() string {
38+
return ak.Spelling()
39+
}

clang/callingconv_gen.go

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package clang
2+
3+
// #include "./clang-c/Index.h"
4+
// #include "go-clang.h"
5+
import "C"
6+
import "fmt"
7+
8+
// CallingConv describes the calling convention of a function type
9+
type CallingConv uint32
10+
11+
const (
12+
CallingConv_Default CallingConv = C.CXCallingConv_Default
13+
CallingConv_C = C.CXCallingConv_C
14+
CallingConv_X86StdCall = C.CXCallingConv_X86StdCall
15+
CallingConv_X86FastCall = C.CXCallingConv_X86FastCall
16+
CallingConv_X86ThisCall = C.CXCallingConv_X86ThisCall
17+
CallingConv_X86Pascal = C.CXCallingConv_X86Pascal
18+
CallingConv_AAPCS = C.CXCallingConv_AAPCS
19+
CallingConv_AAPCS_VFP = C.CXCallingConv_AAPCS_VFP
20+
CallingConv_X86RegCall = C.CXCallingConv_X86RegCall
21+
CallingConv_IntelOclBicc = C.CXCallingConv_IntelOclBicc
22+
CallingConv_Win64 = C.CXCallingConv_Win64
23+
CallingConv_X86_64Win64 = C.CXCallingConv_X86_64Win64
24+
CallingConv_X86_64SysV = C.CXCallingConv_X86_64SysV
25+
CallingConv_X86VectorCall = C.CXCallingConv_X86VectorCall
26+
CallingConv_Swift = C.CXCallingConv_Swift
27+
CallingConv_PreserveMost = C.CXCallingConv_PreserveMost
28+
CallingConv_PreserveAll = C.CXCallingConv_PreserveAll
29+
CallingConv_AArch64VectorCall = C.CXCallingConv_AArch64VectorCall
30+
CallingConv_SwiftAsync = C.CXCallingConv_SwiftAsync
31+
CallingConv_AArch64SVEPCS = C.CXCallingConv_AArch64SVEPCS
32+
CallingConv_Invalid = C.CXCallingConv_Invalid
33+
CallingConv_Unexposed = C.CXCallingConv_Unexposed
34+
)
35+
36+
func (cc CallingConv) Spelling() string {
37+
switch cc {
38+
case CallingConv_Default:
39+
return "CallingConv=Default"
40+
case CallingConv_C:
41+
return "CallingConv=C"
42+
case CallingConv_X86StdCall:
43+
return "CallingConv=X86StdCall"
44+
case CallingConv_X86FastCall:
45+
return "CallingConv=X86FastCall"
46+
case CallingConv_X86ThisCall:
47+
return "CallingConv=X86ThisCall"
48+
case CallingConv_X86Pascal:
49+
return "CallingConv=X86Pascal"
50+
case CallingConv_AAPCS:
51+
return "CallingConv=AAPCS"
52+
case CallingConv_AAPCS_VFP:
53+
return "CallingConv=AAPCS_VFP"
54+
case CallingConv_X86RegCall:
55+
return "CallingConv=X86RegCall"
56+
case CallingConv_IntelOclBicc:
57+
return "CallingConv=IntelOclBicc"
58+
case CallingConv_Win64:
59+
return "CallingConv=Win64, X86_64Win64"
60+
case CallingConv_X86_64SysV:
61+
return "CallingConv=X86_64SysV"
62+
case CallingConv_X86VectorCall:
63+
return "CallingConv=X86VectorCall"
64+
case CallingConv_Swift:
65+
return "CallingConv=Swift"
66+
case CallingConv_PreserveMost:
67+
return "CallingConv=PreserveMost"
68+
case CallingConv_PreserveAll:
69+
return "CallingConv=PreserveAll"
70+
case CallingConv_AArch64VectorCall:
71+
return "CallingConv=AArch64VectorCall"
72+
case CallingConv_SwiftAsync:
73+
return "CallingConv=SwiftAsync"
74+
case CallingConv_AArch64SVEPCS:
75+
return "CallingConv=AArch64SVEPCS"
76+
case CallingConv_Invalid:
77+
return "CallingConv=Invalid"
78+
case CallingConv_Unexposed:
79+
return "CallingConv=Unexposed"
80+
}
81+
82+
return fmt.Sprintf("CallingConv unknown %d", int(cc))
83+
}
84+
85+
func (cc CallingConv) String() string {
86+
return cc.Spelling()
87+
}

clang/cgoflags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package clang
2+
3+
// #cgo CFLAGS: -I${SRCDIR}
4+
import "C"

clang/cgoflags_dynamic.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build !static
2+
// +build !static
3+
4+
package clang
5+
6+
// #cgo LDFLAGS: -lclang
7+
import "C"

clang/cgoflags_static.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//go:build static
2+
// +build static
3+
4+
package clang

clang/childvisitresult_gen.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package clang
2+
3+
// #include "./clang-c/Index.h"
4+
// #include "go-clang.h"
5+
import "C"
6+
import "fmt"
7+
8+
// ChildVisitResult describes how the traversal of the children of a particular
9+
// cursor should proceed after visiting a particular child cursor.
10+
//
11+
// A value of this enumeration type should be returned by each
12+
// CXCursorVisitor to indicate how clang_visitChildren() proceed.
13+
type ChildVisitResult uint32
14+
15+
const (
16+
// ChildVisit_Break terminates the cursor traversal.
17+
ChildVisit_Break ChildVisitResult = C.CXChildVisit_Break
18+
// ChildVisit_Continue continues the cursor traversal with the next sibling of the cursor just visited, without visiting its children.
19+
ChildVisit_Continue = C.CXChildVisit_Continue
20+
// ChildVisit_Recurse recursively traverse the children of this cursor, using the same visitor and client data.
21+
ChildVisit_Recurse = C.CXChildVisit_Recurse
22+
)
23+
24+
func (cvr ChildVisitResult) Spelling() string {
25+
switch cvr {
26+
case ChildVisit_Break:
27+
return "ChildVisit=Break"
28+
case ChildVisit_Continue:
29+
return "ChildVisit=Continue"
30+
case ChildVisit_Recurse:
31+
return "ChildVisit=Recurse"
32+
}
33+
34+
return fmt.Sprintf("ChildVisitResult unknown %d", int(cvr))
35+
}
36+
37+
func (cvr ChildVisitResult) String() string {
38+
return cvr.Spelling()
39+
}

clang/clang-c/BuildSystem.h

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#include <stdint.h>
2+
3+
/*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
4+
|* *|
5+
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
6+
|* Exceptions. *|
7+
|* See https://llvm.org/LICENSE.txt for license information. *|
8+
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
9+
|* *|
10+
|*===----------------------------------------------------------------------===*|
11+
|* *|
12+
|* This header provides various utilities for use by build systems. *|
13+
|* *|
14+
\*===----------------------------------------------------------------------===*/
15+
16+
#ifndef LLVM_CLANG_C_BUILDSYSTEM_H
17+
#define LLVM_CLANG_C_BUILDSYSTEM_H
18+
19+
#include "clang-c/CXErrorCode.h"
20+
#include "clang-c/CXString.h"
21+
#include "clang-c/ExternC.h"
22+
#include "clang-c/Platform.h"
23+
24+
LLVM_CLANG_C_EXTERN_C_BEGIN
25+
26+
/**
27+
* \defgroup BUILD_SYSTEM Build system utilities
28+
* @{
29+
*/
30+
31+
/**
32+
* Return the timestamp for use with Clang's
33+
* \c -fbuild-session-timestamp= option.
34+
*/
35+
CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
36+
37+
/**
38+
* Object encapsulating information about overlaying virtual
39+
* file/directories over the real file system.
40+
*/
41+
typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
42+
43+
/**
44+
* Create a \c CXVirtualFileOverlay object.
45+
* Must be disposed with \c clang_VirtualFileOverlay_dispose().
46+
*
47+
* \param options is reserved, always pass 0.
48+
*/
49+
CINDEX_LINKAGE CXVirtualFileOverlay
50+
clang_VirtualFileOverlay_create(unsigned options);
51+
52+
/**
53+
* Map an absolute virtual file path to an absolute real one.
54+
* The virtual path must be canonicalized (not contain "."/"..").
55+
* \returns 0 for success, non-zero to indicate an error.
56+
*/
57+
CINDEX_LINKAGE enum CXErrorCode
58+
clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
59+
const char *virtualPath,
60+
const char *realPath);
61+
62+
/**
63+
* Set the case sensitivity for the \c CXVirtualFileOverlay object.
64+
* The \c CXVirtualFileOverlay object is case-sensitive by default, this
65+
* option can be used to override the default.
66+
* \returns 0 for success, non-zero to indicate an error.
67+
*/
68+
CINDEX_LINKAGE enum CXErrorCode
69+
clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
70+
int caseSensitive);
71+
72+
/**
73+
* Write out the \c CXVirtualFileOverlay object to a char buffer.
74+
*
75+
* \param options is reserved, always pass 0.
76+
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
77+
* disposed using \c clang_free().
78+
* \param out_buffer_size pointer to receive the buffer size.
79+
* \returns 0 for success, non-zero to indicate an error.
80+
*/
81+
CINDEX_LINKAGE enum CXErrorCode
82+
clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
83+
char **out_buffer_ptr,
84+
unsigned *out_buffer_size);
85+
86+
/**
87+
* free memory allocated by libclang, such as the buffer returned by
88+
* \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
89+
*
90+
* \param buffer memory pointer to free.
91+
*/
92+
CINDEX_LINKAGE void clang_free(void *buffer);
93+
94+
/**
95+
* Dispose a \c CXVirtualFileOverlay object.
96+
*/
97+
CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
98+
99+
/**
100+
* Object encapsulating information about a module.map file.
101+
*/
102+
typedef struct CXModuleMapDescriptorImpl *CXModuleMapDescriptor;
103+
104+
/**
105+
* Create a \c CXModuleMapDescriptor object.
106+
* Must be disposed with \c clang_ModuleMapDescriptor_dispose().
107+
*
108+
* \param options is reserved, always pass 0.
109+
*/
110+
CINDEX_LINKAGE CXModuleMapDescriptor
111+
clang_ModuleMapDescriptor_create(unsigned options);
112+
113+
/**
114+
* Sets the framework module name that the module.map describes.
115+
* \returns 0 for success, non-zero to indicate an error.
116+
*/
117+
CINDEX_LINKAGE enum CXErrorCode
118+
clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
119+
const char *name);
120+
121+
/**
122+
* Sets the umbrella header name that the module.map describes.
123+
* \returns 0 for success, non-zero to indicate an error.
124+
*/
125+
CINDEX_LINKAGE enum CXErrorCode
126+
clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
127+
const char *name);
128+
129+
/**
130+
* Write out the \c CXModuleMapDescriptor object to a char buffer.
131+
*
132+
* \param options is reserved, always pass 0.
133+
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
134+
* disposed using \c clang_free().
135+
* \param out_buffer_size pointer to receive the buffer size.
136+
* \returns 0 for success, non-zero to indicate an error.
137+
*/
138+
CINDEX_LINKAGE enum CXErrorCode
139+
clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
140+
char **out_buffer_ptr,
141+
unsigned *out_buffer_size);
142+
143+
/**
144+
* Dispose a \c CXModuleMapDescriptor object.
145+
*/
146+
CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
147+
148+
/**
149+
* @}
150+
*/
151+
152+
LLVM_CLANG_C_EXTERN_C_END
153+
154+
#endif /* CLANG_C_BUILD_SYSTEM_H */
155+

0 commit comments

Comments
 (0)