Skip to content

Commit 0658c5e

Browse files
committed
clang: generate clang v13 binding
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent 16e6751 commit 0658c5e

File tree

141 files changed

+18500
-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

+18500
-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+
// 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+
// 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+
// The entity is available.
13+
Availability_Available AvailabilityKind = C.CXAvailability_Available
14+
// The entity is available, but has been deprecated (and its use is not recommended).
15+
Availability_Deprecated = C.CXAvailability_Deprecated
16+
// The entity is not available; any use of it will be an error.
17+
Availability_NotAvailable = C.CXAvailability_NotAvailable
18+
// 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: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package clang
2+
3+
// #include "./clang-c/Index.h"
4+
// #include "go-clang.h"
5+
import "C"
6+
import "fmt"
7+
8+
// 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_Invalid = C.CXCallingConv_Invalid
32+
CallingConv_Unexposed = C.CXCallingConv_Unexposed
33+
)
34+
35+
func (cc CallingConv) Spelling() string {
36+
switch cc {
37+
case CallingConv_Default:
38+
return "CallingConv=Default"
39+
case CallingConv_C:
40+
return "CallingConv=C"
41+
case CallingConv_X86StdCall:
42+
return "CallingConv=X86StdCall"
43+
case CallingConv_X86FastCall:
44+
return "CallingConv=X86FastCall"
45+
case CallingConv_X86ThisCall:
46+
return "CallingConv=X86ThisCall"
47+
case CallingConv_X86Pascal:
48+
return "CallingConv=X86Pascal"
49+
case CallingConv_AAPCS:
50+
return "CallingConv=AAPCS"
51+
case CallingConv_AAPCS_VFP:
52+
return "CallingConv=AAPCS_VFP"
53+
case CallingConv_X86RegCall:
54+
return "CallingConv=X86RegCall"
55+
case CallingConv_IntelOclBicc:
56+
return "CallingConv=IntelOclBicc"
57+
case CallingConv_Win64:
58+
return "CallingConv=Win64, X86_64Win64"
59+
case CallingConv_X86_64SysV:
60+
return "CallingConv=X86_64SysV"
61+
case CallingConv_X86VectorCall:
62+
return "CallingConv=X86VectorCall"
63+
case CallingConv_Swift:
64+
return "CallingConv=Swift"
65+
case CallingConv_PreserveMost:
66+
return "CallingConv=PreserveMost"
67+
case CallingConv_PreserveAll:
68+
return "CallingConv=PreserveAll"
69+
case CallingConv_AArch64VectorCall:
70+
return "CallingConv=AArch64VectorCall"
71+
case CallingConv_SwiftAsync:
72+
return "CallingConv=SwiftAsync"
73+
case CallingConv_Invalid:
74+
return "CallingConv=Invalid"
75+
case CallingConv_Unexposed:
76+
return "CallingConv=Unexposed"
77+
}
78+
79+
return fmt.Sprintf("CallingConv unknown %d", int(cc))
80+
}
81+
82+
func (cc CallingConv) String() string {
83+
return cc.Spelling()
84+
}

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

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)