Skip to content

Commit e04b29b

Browse files
committed
clang: update to clang v8
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 26a8eaa commit e04b29b

11 files changed

+417
-27
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- "main"
1010

1111
env:
12-
LLVM_VERSION: 7
12+
LLVM_VERSION: 8
1313

1414
jobs:
1515
test:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export CC := clang
44
export CXX := clang++
55

66
LLVM_LIBDIR?=$(shell llvm-config --libdir)
7-
LLVM_VERSION?=7
7+
LLVM_VERSION?=8
88

99
all: test
1010

clang/callingconv_gen.go

+22-19
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,26 @@ import "fmt"
99
type CallingConv uint32
1010

1111
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_Invalid = C.CXCallingConv_Invalid
30-
CallingConv_Unexposed = C.CXCallingConv_Unexposed
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_Invalid = C.CXCallingConv_Invalid
31+
CallingConv_Unexposed = C.CXCallingConv_Unexposed
3132
)
3233

3334
func (cc CallingConv) Spelling() string {
@@ -64,6 +65,8 @@ func (cc CallingConv) Spelling() string {
6465
return "CallingConv=PreserveMost"
6566
case CallingConv_PreserveAll:
6667
return "CallingConv=PreserveAll"
68+
case CallingConv_AArch64VectorCall:
69+
return "CallingConv=AArch64VectorCall"
6770
case CallingConv_Invalid:
6871
return "CallingConv=Invalid"
6972
case CallingConv_Unexposed:

clang/clang-c/Index.h

+140-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
3535
*/
3636
#define CINDEX_VERSION_MAJOR 0
37-
#define CINDEX_VERSION_MINOR 49
37+
#define CINDEX_VERSION_MINOR 50
3838

3939
#define CINDEX_VERSION_ENCODE(major, minor) ( \
4040
((major) * 10000) \
@@ -180,7 +180,6 @@ typedef struct CXVersion {
180180
* A negative value indicates that the cursor is not a function declaration.
181181
*/
182182
enum CXCursor_ExceptionSpecificationKind {
183-
184183
/**
185184
* The cursor has no exception specification.
186185
*/
@@ -1334,7 +1333,17 @@ enum CXTranslationUnit_Flags {
13341333
*
13351334
* The function bodies of the main file are not skipped.
13361335
*/
1337-
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800
1336+
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800,
1337+
1338+
/**
1339+
* Used to indicate that attributed types should be included in CXType.
1340+
*/
1341+
CXTranslationUnit_IncludeAttributedTypes = 0x1000,
1342+
1343+
/**
1344+
* Used to indicate that implicit attributes should be visited.
1345+
*/
1346+
CXTranslationUnit_VisitImplicitAttributes = 0x2000
13381347
};
13391348

13401349
/**
@@ -2561,7 +2570,25 @@ enum CXCursorKind {
25612570
CXCursor_VisibilityAttr = 417,
25622571
CXCursor_DLLExport = 418,
25632572
CXCursor_DLLImport = 419,
2564-
CXCursor_LastAttr = CXCursor_DLLImport,
2573+
CXCursor_NSReturnsRetained = 420,
2574+
CXCursor_NSReturnsNotRetained = 421,
2575+
CXCursor_NSReturnsAutoreleased = 422,
2576+
CXCursor_NSConsumesSelf = 423,
2577+
CXCursor_NSConsumed = 424,
2578+
CXCursor_ObjCException = 425,
2579+
CXCursor_ObjCNSObject = 426,
2580+
CXCursor_ObjCIndependentClass = 427,
2581+
CXCursor_ObjCPreciseLifetime = 428,
2582+
CXCursor_ObjCReturnsInnerPointer = 429,
2583+
CXCursor_ObjCRequiresSuper = 430,
2584+
CXCursor_ObjCRootClass = 431,
2585+
CXCursor_ObjCSubclassingRestricted = 432,
2586+
CXCursor_ObjCExplicitProtocolImpl = 433,
2587+
CXCursor_ObjCDesignatedInitializer = 434,
2588+
CXCursor_ObjCRuntimeVisible = 435,
2589+
CXCursor_ObjCBoxable = 436,
2590+
CXCursor_FlagEnum = 437,
2591+
CXCursor_LastAttr = CXCursor_FlagEnum,
25652592

25662593
/* Preprocessing */
25672594
CXCursor_PreprocessingDirective = 500,
@@ -3268,7 +3295,25 @@ enum CXTypeKind {
32683295
CXType_OCLSampler = 157,
32693296
CXType_OCLEvent = 158,
32703297
CXType_OCLQueue = 159,
3271-
CXType_OCLReserveID = 160
3298+
CXType_OCLReserveID = 160,
3299+
3300+
CXType_ObjCObject = 161,
3301+
CXType_ObjCTypeParam = 162,
3302+
CXType_Attributed = 163,
3303+
3304+
CXType_OCLIntelSubgroupAVCMcePayload = 164,
3305+
CXType_OCLIntelSubgroupAVCImePayload = 165,
3306+
CXType_OCLIntelSubgroupAVCRefPayload = 166,
3307+
CXType_OCLIntelSubgroupAVCSicPayload = 167,
3308+
CXType_OCLIntelSubgroupAVCMceResult = 168,
3309+
CXType_OCLIntelSubgroupAVCImeResult = 169,
3310+
CXType_OCLIntelSubgroupAVCRefResult = 170,
3311+
CXType_OCLIntelSubgroupAVCSicResult = 171,
3312+
CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172,
3313+
CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173,
3314+
CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174,
3315+
3316+
CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175
32723317
};
32733318

32743319
/**
@@ -3293,6 +3338,7 @@ enum CXCallingConv {
32933338
CXCallingConv_Swift = 13,
32943339
CXCallingConv_PreserveMost = 14,
32953340
CXCallingConv_PreserveAll = 15,
3341+
CXCallingConv_AArch64VectorCall = 16,
32963342

32973343
CXCallingConv_Invalid = 100,
32983344
CXCallingConv_Unexposed = 200
@@ -3629,6 +3675,43 @@ CINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
36293675
*/
36303676
CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
36313677

3678+
/**
3679+
* Retrieves the base type of the ObjCObjectType.
3680+
*
3681+
* If the type is not an ObjC object, an invalid type is returned.
3682+
*/
3683+
CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T);
3684+
3685+
/**
3686+
* Retrieve the number of protocol references associated with an ObjC object/id.
3687+
*
3688+
* If the type is not an ObjC object, 0 is returned.
3689+
*/
3690+
CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T);
3691+
3692+
/**
3693+
* Retrieve the decl for a protocol reference for an ObjC object/id.
3694+
*
3695+
* If the type is not an ObjC object or there are not enough protocol
3696+
* references, an invalid cursor is returned.
3697+
*/
3698+
CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i);
3699+
3700+
/**
3701+
* Retreive the number of type arguments associated with an ObjC object.
3702+
*
3703+
* If the type is not an ObjC object, 0 is returned.
3704+
*/
3705+
CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T);
3706+
3707+
/**
3708+
* Retrieve a type argument associated with an ObjC object.
3709+
*
3710+
* If the type is not an ObjC or the index is not valid,
3711+
* an invalid type is returned.
3712+
*/
3713+
CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i);
3714+
36323715
/**
36333716
* Return 1 if the CXType is a variadic function type, and 0 otherwise.
36343717
*/
@@ -3702,6 +3785,33 @@ CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T);
37023785
*/
37033786
CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T);
37043787

3788+
enum CXTypeNullabilityKind {
3789+
/**
3790+
* Values of this type can never be null.
3791+
*/
3792+
CXTypeNullability_NonNull = 0,
3793+
/**
3794+
* Values of this type can be null.
3795+
*/
3796+
CXTypeNullability_Nullable = 1,
3797+
/**
3798+
* Whether values of this type can be null is (explicitly)
3799+
* unspecified. This captures a (fairly rare) case where we
3800+
* can't conclude anything about the nullability of the type even
3801+
* though it has been considered.
3802+
*/
3803+
CXTypeNullability_Unspecified = 2,
3804+
/**
3805+
* Nullability is not applicable to this type.
3806+
*/
3807+
CXTypeNullability_Invalid = 3
3808+
};
3809+
3810+
/**
3811+
* Retrieve the nullability kind of a pointer type.
3812+
*/
3813+
CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T);
3814+
37053815
/**
37063816
* List the possible error codes for \c clang_Type_getSizeOf,
37073817
* \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
@@ -3780,6 +3890,13 @@ CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
37803890
*/
37813891
CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
37823892

3893+
/**
3894+
* Return the type that was modified by this attributed type.
3895+
*
3896+
* If the type is not an attributed type, an invalid type is returned.
3897+
*/
3898+
CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T);
3899+
37833900
/**
37843901
* Return the offset of the field represented by the Cursor.
37853902
*
@@ -4349,6 +4466,18 @@ typedef enum {
43494466
CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
43504467
unsigned reserved);
43514468

4469+
/**
4470+
* Given a cursor that represents a property declaration, return the
4471+
* name of the method that implements the getter.
4472+
*/
4473+
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C);
4474+
4475+
/**
4476+
* Given a cursor that represents a property declaration, return the
4477+
* name of the method that implements the setter, if any.
4478+
*/
4479+
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C);
4480+
43524481
/**
43534482
* 'Qualifiers' written next to the return and parameter types in
43544483
* Objective-C method declarations.
@@ -5493,10 +5622,15 @@ enum CXCompletionContext {
54935622
*/
54945623
CXCompletionContext_NaturalLanguage = 1 << 21,
54955624

5625+
/**
5626+
* #include file completions should be included in the results.
5627+
*/
5628+
CXCompletionContext_IncludedFile = 1 << 22,
5629+
54965630
/**
54975631
* The current context is unknown, so set all contexts.
54985632
*/
5499-
CXCompletionContext_Unknown = ((1 << 22) - 1)
5633+
CXCompletionContext_Unknown = ((1 << 23) - 1)
55005634
};
55015635

55025636
/**

clang/completioncontext_gen.go

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const (
6060
CompletionContext_MacroName = C.CXCompletionContext_MacroName
6161
// Natural language completions should be included in the results.
6262
CompletionContext_NaturalLanguage = C.CXCompletionContext_NaturalLanguage
63+
// #include file completions should be included in the results.
64+
CompletionContext_IncludedFile = C.CXCompletionContext_IncludedFile
6365
// The current context is unknown, so set all contexts.
6466
CompletionContext_Unknown = C.CXCompletionContext_Unknown
6567
)
@@ -112,6 +114,8 @@ func (cc CompletionContext) Spelling() string {
112114
return "CompletionContext=MacroName"
113115
case CompletionContext_NaturalLanguage:
114116
return "CompletionContext=NaturalLanguage"
117+
case CompletionContext_IncludedFile:
118+
return "CompletionContext=IncludedFile"
115119
case CompletionContext_Unknown:
116120
return "CompletionContext=Unknown"
117121
}

clang/cursor_gen.go

+16
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,22 @@ func (c Cursor) PropertyAttributes(reserved uint32) uint32 {
849849
return uint32(C.clang_Cursor_getObjCPropertyAttributes(c.c, C.uint(reserved)))
850850
}
851851

852+
// Given a cursor that represents a property declaration, return the name of the method that implements the getter.
853+
func (c Cursor) PropertyGetterName() string {
854+
o := cxstring{C.clang_Cursor_getObjCPropertyGetterName(c.c)}
855+
defer o.Dispose()
856+
857+
return o.String()
858+
}
859+
860+
// Given a cursor that represents a property declaration, return the name of the method that implements the setter, if any.
861+
func (c Cursor) PropertySetterName() string {
862+
o := cxstring{C.clang_Cursor_getObjCPropertySetterName(c.c)}
863+
defer o.Dispose()
864+
865+
return o.String()
866+
}
867+
852868
// Given a cursor that represents an Objective-C method or parameter declaration, return the associated Objective-C qualifiers for the return type or the parameter respectively. The bits are formed from CXObjCDeclQualifierKind.
853869
func (c Cursor) DeclQualifiers() uint32 {
854870
return uint32(C.clang_Cursor_getObjCDeclQualifiers(c.c))

clang/cursorkind_gen.go

+36
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,42 @@ const (
632632
// An attribute whose specific kind is not exposed via this interface.
633633
Cursor_DLLImport = C.CXCursor_DLLImport
634634
// An attribute whose specific kind is not exposed via this interface.
635+
Cursor_NSReturnsRetained = C.CXCursor_NSReturnsRetained
636+
// An attribute whose specific kind is not exposed via this interface.
637+
Cursor_NSReturnsNotRetained = C.CXCursor_NSReturnsNotRetained
638+
// An attribute whose specific kind is not exposed via this interface.
639+
Cursor_NSReturnsAutoreleased = C.CXCursor_NSReturnsAutoreleased
640+
// An attribute whose specific kind is not exposed via this interface.
641+
Cursor_NSConsumesSelf = C.CXCursor_NSConsumesSelf
642+
// An attribute whose specific kind is not exposed via this interface.
643+
Cursor_NSConsumed = C.CXCursor_NSConsumed
644+
// An attribute whose specific kind is not exposed via this interface.
645+
Cursor_ObjCException = C.CXCursor_ObjCException
646+
// An attribute whose specific kind is not exposed via this interface.
647+
Cursor_ObjCNSObject = C.CXCursor_ObjCNSObject
648+
// An attribute whose specific kind is not exposed via this interface.
649+
Cursor_ObjCIndependentClass = C.CXCursor_ObjCIndependentClass
650+
// An attribute whose specific kind is not exposed via this interface.
651+
Cursor_ObjCPreciseLifetime = C.CXCursor_ObjCPreciseLifetime
652+
// An attribute whose specific kind is not exposed via this interface.
653+
Cursor_ObjCReturnsInnerPointer = C.CXCursor_ObjCReturnsInnerPointer
654+
// An attribute whose specific kind is not exposed via this interface.
655+
Cursor_ObjCRequiresSuper = C.CXCursor_ObjCRequiresSuper
656+
// An attribute whose specific kind is not exposed via this interface.
657+
Cursor_ObjCRootClass = C.CXCursor_ObjCRootClass
658+
// An attribute whose specific kind is not exposed via this interface.
659+
Cursor_ObjCSubclassingRestricted = C.CXCursor_ObjCSubclassingRestricted
660+
// An attribute whose specific kind is not exposed via this interface.
661+
Cursor_ObjCExplicitProtocolImpl = C.CXCursor_ObjCExplicitProtocolImpl
662+
// An attribute whose specific kind is not exposed via this interface.
663+
Cursor_ObjCDesignatedInitializer = C.CXCursor_ObjCDesignatedInitializer
664+
// An attribute whose specific kind is not exposed via this interface.
665+
Cursor_ObjCRuntimeVisible = C.CXCursor_ObjCRuntimeVisible
666+
// An attribute whose specific kind is not exposed via this interface.
667+
Cursor_ObjCBoxable = C.CXCursor_ObjCBoxable
668+
// An attribute whose specific kind is not exposed via this interface.
669+
Cursor_FlagEnum = C.CXCursor_FlagEnum
670+
// An attribute whose specific kind is not exposed via this interface.
635671
Cursor_LastAttr = C.CXCursor_LastAttr
636672
// An attribute whose specific kind is not exposed via this interface.
637673
Cursor_PreprocessingDirective = C.CXCursor_PreprocessingDirective

0 commit comments

Comments
 (0)