Skip to content

Commit e1e0f98

Browse files
committed
clang: update to clang v11
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent a52155a commit e1e0f98

File tree

9 files changed

+581
-573
lines changed

9 files changed

+581
-573
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- "main"
1010

1111
env:
12-
LLVM_VERSION: 10
12+
LLVM_VERSION: 11
1313

1414
jobs:
1515
test:

clang/clang-c/BuildSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
119119
const char *name);
120120

121121
/**
122-
* Sets the umbrealla header name that the module.map describes.
122+
* Sets the umbrella header name that the module.map describes.
123123
* \returns 0 for success, non-zero to indicate an error.
124124
*/
125125
CINDEX_LINKAGE enum CXErrorCode

clang/clang-c/Index.h

Lines changed: 518 additions & 547 deletions
Large diffs are not rendered by default.

clang/clang-c/Platform.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@
2020

2121
LLVM_CLANG_C_EXTERN_C_BEGIN
2222

23-
/* MSVC DLL import/export. */
24-
#ifdef _MSC_VER
25-
#ifdef _CINDEX_LIB_
26-
#define CINDEX_LINKAGE __declspec(dllexport)
27-
#else
28-
#define CINDEX_LINKAGE __declspec(dllimport)
23+
/* Windows DLL import/export. */
24+
#ifndef CINDEX_NO_EXPORTS
25+
#define CINDEX_EXPORTS
26+
#endif
27+
#ifdef _WIN32
28+
#ifdef CINDEX_EXPORTS
29+
#ifdef _CINDEX_LIB_
30+
#define CINDEX_LINKAGE __declspec(dllexport)
31+
#else
32+
#define CINDEX_LINKAGE __declspec(dllimport)
33+
#endif
2934
#endif
30-
#else
35+
#elif defined(CINDEX_EXPORTS) && defined(__GNUC__)
36+
#define CINDEX_LINKAGE __attribute__((visibility("default")))
37+
#endif
38+
39+
#ifndef CINDEX_LINKAGE
3140
#define CINDEX_LINKAGE
3241
#endif
3342

clang/cursor_gen.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ func (c Cursor) EnumDeclIntegerType() Type {
337337
Retrieve the integer value of an enum constant declaration as a signed
338338
long long.
339339
340-
If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
341-
Since this is also potentially a valid constant value, the kind of the cursor
342-
must be verified before calling this function.
340+
If the cursor does not reference an enum constant declaration, LLONG_MIN is
341+
returned. Since this is also potentially a valid constant value, the kind of
342+
the cursor must be verified before calling this function.
343343
*/
344344
func (c Cursor) EnumConstantDeclValue() int64 {
345345
return int64(C.clang_getEnumConstantDeclValue(c.c))
@@ -349,9 +349,9 @@ func (c Cursor) EnumConstantDeclValue() int64 {
349349
Retrieve the integer value of an enum constant declaration as an unsigned
350350
long long.
351351
352-
If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
353-
Since this is also potentially a valid constant value, the kind of the cursor
354-
must be verified before calling this function.
352+
If the cursor does not reference an enum constant declaration, ULLONG_MAX is
353+
returned. Since this is also potentially a valid constant value, the kind of
354+
the cursor must be verified before calling this function.
355355
*/
356356
func (c Cursor) EnumConstantDeclUnsignedValue() uint64 {
357357
return uint64(C.clang_getEnumConstantDeclUnsignedValue(c.c))
@@ -534,7 +534,8 @@ func (c Cursor) ResultType() Type {
534534
Retrieve the exception specification type associated with a given cursor.
535535
This is a value of type CXCursor_ExceptionSpecificationKind.
536536
537-
This only returns a valid result if the cursor refers to a function or method.
537+
This only returns a valid result if the cursor refers to a function or
538+
method.
538539
*/
539540
func (c Cursor) ExceptionSpecificationType() int32 {
540541
return int32(C.clang_getCursorExceptionSpecificationType(c.c))
@@ -595,9 +596,9 @@ func (c Cursor) IsVirtualBase() bool {
595596
/*
596597
Returns the access control level for the referenced object.
597598
598-
If the cursor refers to a C++ declaration, its access control level within its
599-
parent scope is returned. Otherwise, if the cursor refers to a base specifier or
600-
access specifier, the specifier itself is returned.
599+
If the cursor refers to a C++ declaration, its access control level within
600+
its parent scope is returned. Otherwise, if the cursor refers to a base
601+
specifier or access specifier, the specifier itself is returned.
601602
*/
602603
func (c Cursor) AccessSpecifier() AccessSpecifier {
603604
return AccessSpecifier(C.clang_getCXXAccessSpecifier(c.c))
@@ -1168,7 +1169,7 @@ func (c Cursor) CompletionString() CompletionString {
11681169
return CompletionString{C.clang_getCursorCompletionString(c.c)}
11691170
}
11701171

1171-
// If cursor is a statement declaration tries to evaluate the statement and if its variable, tries to evaluate its initializer, into its corresponding type.
1172+
// If cursor is a statement declaration tries to evaluate the statement and if its variable, tries to evaluate its initializer, into its corresponding type. If it's an expression, tries to evaluate the expression.
11721173
func (c Cursor) Evaluate() EvalResult {
11731174
return EvalResult{C.clang_Cursor_Evaluate(c.c)}
11741175
}

clang/cursorkind_gen.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ const (
306306
\endcode
307307
*/
308308
Cursor_CXXFunctionalCastExpr = C.CXCursor_CXXFunctionalCastExpr
309+
// OpenCL's addrspace_cast<> expression.
310+
Cursor_CXXAddrspaceCastExpr = C.CXCursor_CXXAddrspaceCastExpr
309311
// A C++ typeid expression (C++ [expr.typeid]).
310312
Cursor_CXXTypeidExpr = C.CXCursor_CXXTypeidExpr
311313
// [C++ 2.13.5] C++ Boolean Literal.
@@ -376,15 +378,19 @@ const (
376378
Cursor_ObjCBoolLiteralExpr = C.CXCursor_ObjCBoolLiteralExpr
377379
// Represents the "self" expression in an Objective-C method.
378380
Cursor_ObjCSelfExpr = C.CXCursor_ObjCSelfExpr
379-
// OpenMP 4.0 [2.4, Array Section].
381+
// OpenMP 5.0 [2.1.5, Array Section].
380382
Cursor_OMPArraySectionExpr = C.CXCursor_OMPArraySectionExpr
381383
// Represents an @available(...) check.
382384
Cursor_ObjCAvailabilityCheckExpr = C.CXCursor_ObjCAvailabilityCheckExpr
383385
// Fixed point literal
384386
Cursor_FixedPointLiteral = C.CXCursor_FixedPointLiteral
385-
// Fixed point literal
387+
// OpenMP 5.0 [2.1.4, Array Shaping].
388+
Cursor_OMPArrayShapingExpr = C.CXCursor_OMPArrayShapingExpr
389+
// OpenMP 5.0 [2.1.6 Iterators]
390+
Cursor_OMPIteratorExpr = C.CXCursor_OMPIteratorExpr
391+
// OpenMP 5.0 [2.1.6 Iterators]
386392
Cursor_LastExpr = C.CXCursor_LastExpr
387-
// Fixed point literal
393+
// OpenMP 5.0 [2.1.6 Iterators]
388394
Cursor_FirstStmt = C.CXCursor_FirstStmt
389395
/*
390396
A statement whose specific kind is not exposed via this
@@ -587,7 +593,11 @@ const (
587593
Cursor_OMPParallelMasterTaskLoopSimdDirective = C.CXCursor_OMPParallelMasterTaskLoopSimdDirective
588594
// OpenMP parallel master directive.
589595
Cursor_OMPParallelMasterDirective = C.CXCursor_OMPParallelMasterDirective
590-
// OpenMP parallel master directive.
596+
// OpenMP depobj directive.
597+
Cursor_OMPDepobjDirective = C.CXCursor_OMPDepobjDirective
598+
// OpenMP scan directive.
599+
Cursor_OMPScanDirective = C.CXCursor_OMPScanDirective
600+
// OpenMP scan directive.
591601
Cursor_LastStmt = C.CXCursor_LastStmt
592602
/*
593603
Cursor that represents the translation unit itself.

clang/modulemapdescriptor_gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (mmd ModuleMapDescriptor) SetFrameworkModuleName(name string) ErrorCode {
2828
return ErrorCode(C.clang_ModuleMapDescriptor_setFrameworkModuleName(mmd.c, c_name))
2929
}
3030

31-
// Sets the umbrealla header name that the module.map describes. Returns 0 for success, non-zero to indicate an error.
31+
// Sets the umbrella header name that the module.map describes. Returns 0 for success, non-zero to indicate an error.
3232
func (mmd ModuleMapDescriptor) SetUmbrellaHeader(name string) ErrorCode {
3333
c_name := C.CString(name)
3434
defer C.free(unsafe.Pointer(c_name))

clang/type_gen.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (t Type) ProtocolDecl(i uint32) Cursor {
176176
}
177177

178178
/*
179-
Retreive the number of type arguments associated with an ObjC object.
179+
Retrieve the number of type arguments associated with an ObjC object.
180180
181181
If the type is not an ObjC object, 0 is returned.
182182
*/
@@ -341,6 +341,15 @@ func (t Type) ModifiedType() Type {
341341
return Type{C.clang_Type_getModifiedType(t.c)}
342342
}
343343

344+
/*
345+
Gets the type contained by this atomic type.
346+
347+
If a non-atomic type is passed in, an invalid type is returned.
348+
*/
349+
func (t Type) ValueType() Type {
350+
return Type{C.clang_Type_getValueType(t.c)}
351+
}
352+
344353
// Returns the number of template arguments for given template specialization, or -1 if type T is not a template specialization.
345354
func (t Type) NumTemplateArguments() int32 {
346355
return int32(C.clang_Type_getNumTemplateArguments(t.c))

clang/typekind_gen.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ const (
8787
// A type whose specific kind is not exposed via this interface.
8888
Type_ULongAccum = C.CXType_ULongAccum
8989
// A type whose specific kind is not exposed via this interface.
90+
Type_BFloat16 = C.CXType_BFloat16
91+
// A type whose specific kind is not exposed via this interface.
9092
Type_FirstBuiltin = C.CXType_FirstBuiltin
9193
// A type whose specific kind is not exposed via this interface.
9294
Type_LastBuiltin = C.CXType_LastBuiltin
@@ -476,6 +478,12 @@ const (
476478
E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
477479
*/
478480
Type_ExtVector = C.CXType_ExtVector
481+
/*
482+
Represents a type that was referred to using an elaborated type keyword.
483+
484+
E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
485+
*/
486+
Type_Atomic = C.CXType_Atomic
479487
)
480488

481489
// Retrieve the spelling of a given CXTypeKind.

0 commit comments

Comments
 (0)