Skip to content

Commit

Permalink
clang: update to clang v8
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Nov 17, 2021
1 parent 26a8eaa commit e04b29b
Show file tree
Hide file tree
Showing 11 changed files with 417 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "main"

env:
LLVM_VERSION: 7
LLVM_VERSION: 8

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export CC := clang
export CXX := clang++

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

all: test

Expand Down
41 changes: 22 additions & 19 deletions clang/callingconv_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ import "fmt"
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_Invalid = C.CXCallingConv_Invalid
CallingConv_Unexposed = C.CXCallingConv_Unexposed
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_Invalid = C.CXCallingConv_Invalid
CallingConv_Unexposed = C.CXCallingConv_Unexposed
)

func (cc CallingConv) Spelling() string {
Expand Down Expand Up @@ -64,6 +65,8 @@ func (cc CallingConv) Spelling() string {
return "CallingConv=PreserveMost"
case CallingConv_PreserveAll:
return "CallingConv=PreserveAll"
case CallingConv_AArch64VectorCall:
return "CallingConv=AArch64VectorCall"
case CallingConv_Invalid:
return "CallingConv=Invalid"
case CallingConv_Unexposed:
Expand Down
146 changes: 140 additions & 6 deletions clang/clang-c/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
*/
#define CINDEX_VERSION_MAJOR 0
#define CINDEX_VERSION_MINOR 49
#define CINDEX_VERSION_MINOR 50

#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
Expand Down Expand Up @@ -180,7 +180,6 @@ typedef struct CXVersion {
* A negative value indicates that the cursor is not a function declaration.
*/
enum CXCursor_ExceptionSpecificationKind {

/**
* The cursor has no exception specification.
*/
Expand Down Expand Up @@ -1334,7 +1333,17 @@ enum CXTranslationUnit_Flags {
*
* The function bodies of the main file are not skipped.
*/
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800,

/**
* Used to indicate that attributed types should be included in CXType.
*/
CXTranslationUnit_IncludeAttributedTypes = 0x1000,

/**
* Used to indicate that implicit attributes should be visited.
*/
CXTranslationUnit_VisitImplicitAttributes = 0x2000
};

/**
Expand Down Expand Up @@ -2561,7 +2570,25 @@ enum CXCursorKind {
CXCursor_VisibilityAttr = 417,
CXCursor_DLLExport = 418,
CXCursor_DLLImport = 419,
CXCursor_LastAttr = CXCursor_DLLImport,
CXCursor_NSReturnsRetained = 420,
CXCursor_NSReturnsNotRetained = 421,
CXCursor_NSReturnsAutoreleased = 422,
CXCursor_NSConsumesSelf = 423,
CXCursor_NSConsumed = 424,
CXCursor_ObjCException = 425,
CXCursor_ObjCNSObject = 426,
CXCursor_ObjCIndependentClass = 427,
CXCursor_ObjCPreciseLifetime = 428,
CXCursor_ObjCReturnsInnerPointer = 429,
CXCursor_ObjCRequiresSuper = 430,
CXCursor_ObjCRootClass = 431,
CXCursor_ObjCSubclassingRestricted = 432,
CXCursor_ObjCExplicitProtocolImpl = 433,
CXCursor_ObjCDesignatedInitializer = 434,
CXCursor_ObjCRuntimeVisible = 435,
CXCursor_ObjCBoxable = 436,
CXCursor_FlagEnum = 437,
CXCursor_LastAttr = CXCursor_FlagEnum,

/* Preprocessing */
CXCursor_PreprocessingDirective = 500,
Expand Down Expand Up @@ -3268,7 +3295,25 @@ enum CXTypeKind {
CXType_OCLSampler = 157,
CXType_OCLEvent = 158,
CXType_OCLQueue = 159,
CXType_OCLReserveID = 160
CXType_OCLReserveID = 160,

CXType_ObjCObject = 161,
CXType_ObjCTypeParam = 162,
CXType_Attributed = 163,

CXType_OCLIntelSubgroupAVCMcePayload = 164,
CXType_OCLIntelSubgroupAVCImePayload = 165,
CXType_OCLIntelSubgroupAVCRefPayload = 166,
CXType_OCLIntelSubgroupAVCSicPayload = 167,
CXType_OCLIntelSubgroupAVCMceResult = 168,
CXType_OCLIntelSubgroupAVCImeResult = 169,
CXType_OCLIntelSubgroupAVCRefResult = 170,
CXType_OCLIntelSubgroupAVCSicResult = 171,
CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172,
CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173,
CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174,

CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175
};

/**
Expand All @@ -3293,6 +3338,7 @@ enum CXCallingConv {
CXCallingConv_Swift = 13,
CXCallingConv_PreserveMost = 14,
CXCallingConv_PreserveAll = 15,
CXCallingConv_AArch64VectorCall = 16,

CXCallingConv_Invalid = 100,
CXCallingConv_Unexposed = 200
Expand Down Expand Up @@ -3629,6 +3675,43 @@ CINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
*/
CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);

/**
* Retrieves the base type of the ObjCObjectType.
*
* If the type is not an ObjC object, an invalid type is returned.
*/
CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T);

/**
* Retrieve the number of protocol references associated with an ObjC object/id.
*
* If the type is not an ObjC object, 0 is returned.
*/
CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T);

/**
* Retrieve the decl for a protocol reference for an ObjC object/id.
*
* If the type is not an ObjC object or there are not enough protocol
* references, an invalid cursor is returned.
*/
CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i);

/**
* Retreive the number of type arguments associated with an ObjC object.
*
* If the type is not an ObjC object, 0 is returned.
*/
CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T);

/**
* Retrieve a type argument associated with an ObjC object.
*
* If the type is not an ObjC or the index is not valid,
* an invalid type is returned.
*/
CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i);

/**
* Return 1 if the CXType is a variadic function type, and 0 otherwise.
*/
Expand Down Expand Up @@ -3702,6 +3785,33 @@ CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T);
*/
CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T);

enum CXTypeNullabilityKind {
/**
* Values of this type can never be null.
*/
CXTypeNullability_NonNull = 0,
/**
* Values of this type can be null.
*/
CXTypeNullability_Nullable = 1,
/**
* Whether values of this type can be null is (explicitly)
* unspecified. This captures a (fairly rare) case where we
* can't conclude anything about the nullability of the type even
* though it has been considered.
*/
CXTypeNullability_Unspecified = 2,
/**
* Nullability is not applicable to this type.
*/
CXTypeNullability_Invalid = 3
};

/**
* Retrieve the nullability kind of a pointer type.
*/
CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T);

/**
* List the possible error codes for \c clang_Type_getSizeOf,
* \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
Expand Down Expand Up @@ -3780,6 +3890,13 @@ CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
*/
CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);

/**
* Return the type that was modified by this attributed type.
*
* If the type is not an attributed type, an invalid type is returned.
*/
CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T);

/**
* Return the offset of the field represented by the Cursor.
*
Expand Down Expand Up @@ -4349,6 +4466,18 @@ typedef enum {
CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
unsigned reserved);

/**
* Given a cursor that represents a property declaration, return the
* name of the method that implements the getter.
*/
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C);

/**
* Given a cursor that represents a property declaration, return the
* name of the method that implements the setter, if any.
*/
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C);

/**
* 'Qualifiers' written next to the return and parameter types in
* Objective-C method declarations.
Expand Down Expand Up @@ -5493,10 +5622,15 @@ enum CXCompletionContext {
*/
CXCompletionContext_NaturalLanguage = 1 << 21,

/**
* #include file completions should be included in the results.
*/
CXCompletionContext_IncludedFile = 1 << 22,

/**
* The current context is unknown, so set all contexts.
*/
CXCompletionContext_Unknown = ((1 << 22) - 1)
CXCompletionContext_Unknown = ((1 << 23) - 1)
};

/**
Expand Down
4 changes: 4 additions & 0 deletions clang/completioncontext_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const (
CompletionContext_MacroName = C.CXCompletionContext_MacroName
// Natural language completions should be included in the results.
CompletionContext_NaturalLanguage = C.CXCompletionContext_NaturalLanguage
// #include file completions should be included in the results.
CompletionContext_IncludedFile = C.CXCompletionContext_IncludedFile
// The current context is unknown, so set all contexts.
CompletionContext_Unknown = C.CXCompletionContext_Unknown
)
Expand Down Expand Up @@ -112,6 +114,8 @@ func (cc CompletionContext) Spelling() string {
return "CompletionContext=MacroName"
case CompletionContext_NaturalLanguage:
return "CompletionContext=NaturalLanguage"
case CompletionContext_IncludedFile:
return "CompletionContext=IncludedFile"
case CompletionContext_Unknown:
return "CompletionContext=Unknown"
}
Expand Down
16 changes: 16 additions & 0 deletions clang/cursor_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,22 @@ func (c Cursor) PropertyAttributes(reserved uint32) uint32 {
return uint32(C.clang_Cursor_getObjCPropertyAttributes(c.c, C.uint(reserved)))
}

// Given a cursor that represents a property declaration, return the name of the method that implements the getter.
func (c Cursor) PropertyGetterName() string {
o := cxstring{C.clang_Cursor_getObjCPropertyGetterName(c.c)}
defer o.Dispose()

return o.String()
}

// Given a cursor that represents a property declaration, return the name of the method that implements the setter, if any.
func (c Cursor) PropertySetterName() string {
o := cxstring{C.clang_Cursor_getObjCPropertySetterName(c.c)}
defer o.Dispose()

return o.String()
}

// 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.
func (c Cursor) DeclQualifiers() uint32 {
return uint32(C.clang_Cursor_getObjCDeclQualifiers(c.c))
Expand Down
36 changes: 36 additions & 0 deletions clang/cursorkind_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,42 @@ const (
// An attribute whose specific kind is not exposed via this interface.
Cursor_DLLImport = C.CXCursor_DLLImport
// An attribute whose specific kind is not exposed via this interface.
Cursor_NSReturnsRetained = C.CXCursor_NSReturnsRetained
// An attribute whose specific kind is not exposed via this interface.
Cursor_NSReturnsNotRetained = C.CXCursor_NSReturnsNotRetained
// An attribute whose specific kind is not exposed via this interface.
Cursor_NSReturnsAutoreleased = C.CXCursor_NSReturnsAutoreleased
// An attribute whose specific kind is not exposed via this interface.
Cursor_NSConsumesSelf = C.CXCursor_NSConsumesSelf
// An attribute whose specific kind is not exposed via this interface.
Cursor_NSConsumed = C.CXCursor_NSConsumed
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCException = C.CXCursor_ObjCException
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCNSObject = C.CXCursor_ObjCNSObject
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCIndependentClass = C.CXCursor_ObjCIndependentClass
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCPreciseLifetime = C.CXCursor_ObjCPreciseLifetime
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCReturnsInnerPointer = C.CXCursor_ObjCReturnsInnerPointer
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCRequiresSuper = C.CXCursor_ObjCRequiresSuper
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCRootClass = C.CXCursor_ObjCRootClass
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCSubclassingRestricted = C.CXCursor_ObjCSubclassingRestricted
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCExplicitProtocolImpl = C.CXCursor_ObjCExplicitProtocolImpl
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCDesignatedInitializer = C.CXCursor_ObjCDesignatedInitializer
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCRuntimeVisible = C.CXCursor_ObjCRuntimeVisible
// An attribute whose specific kind is not exposed via this interface.
Cursor_ObjCBoxable = C.CXCursor_ObjCBoxable
// An attribute whose specific kind is not exposed via this interface.
Cursor_FlagEnum = C.CXCursor_FlagEnum
// An attribute whose specific kind is not exposed via this interface.
Cursor_LastAttr = C.CXCursor_LastAttr
// An attribute whose specific kind is not exposed via this interface.
Cursor_PreprocessingDirective = C.CXCursor_PreprocessingDirective
Expand Down
Loading

0 comments on commit e04b29b

Please sign in to comment.