Skip to content

Commit c9945cc

Browse files
committed
[libclang] Expose ext_vector_type
Differential Revision: https://reviews.llvm.org/D60775 llvm-svn: 358566
1 parent 2bc3a19 commit c9945cc

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

clang/bindings/python/clang/cindex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,8 @@ def __repr__(self):
21212121
TypeKind.OCLQUEUE = TypeKind(159)
21222122
TypeKind.OCLRESERVEID = TypeKind(160)
21232123

2124+
TypeKind.EXTVECTOR = TypeKind(176)
2125+
21242126
class RefQualifierKind(BaseEnumeration):
21252127
"""Describes a specific ref-qualifier of a type."""
21262128

clang/include/clang-c/Index.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
3333
*/
3434
#define CINDEX_VERSION_MAJOR 0
35-
#define CINDEX_VERSION_MINOR 54
35+
#define CINDEX_VERSION_MINOR 55
3636

3737
#define CINDEX_VERSION_ENCODE(major, minor) ( \
3838
((major) * 10000) \
@@ -3315,7 +3315,9 @@ enum CXTypeKind {
33153315
CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173,
33163316
CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174,
33173317

3318-
CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175
3318+
CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175,
3319+
3320+
CXType_ExtVector = 176
33193321
};
33203322

33213323
/**

clang/test/Index/opencl-types.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ void kernel testFloatTypes() {
1717
}
1818

1919
// CHECK: VarDecl=scalarHalf:11:8 (Definition){{( \(invalid\))?}} [type=half] [typekind=Half] [isPOD=1]
20-
// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1]
20+
// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [isPOD=1]
2121
// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1]
22-
// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1]
22+
// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [isPOD=1]
2323
// CHECK: VarDecl=scalarDouble:15:10 (Definition){{( \(invalid\))?}} [type=double] [typekind=Double] [isPOD=1]
24-
// CHECK: VarDecl=vectorDouble:16:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1]
24+
// CHECK: VarDecl=vectorDouble:16:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [isPOD=1]
2525

2626
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
2727

clang/tools/libclang/CXType.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static CXTypeKind GetTypeKind(QualType T) {
109109
TKCASE(VariableArray);
110110
TKCASE(DependentSizedArray);
111111
TKCASE(Vector);
112+
TKCASE(ExtVector);
112113
TKCASE(MemberPointer);
113114
TKCASE(Auto);
114115
TKCASE(Elaborated);
@@ -600,6 +601,7 @@ CXString clang_getTypeKindSpelling(enum CXTypeKind K) {
600601
TKIND(VariableArray);
601602
TKIND(DependentSizedArray);
602603
TKIND(Vector);
604+
TKIND(ExtVector);
603605
TKIND(MemberPointer);
604606
TKIND(Auto);
605607
TKIND(Elaborated);
@@ -804,6 +806,9 @@ CXType clang_getElementType(CXType CT) {
804806
case Type::Vector:
805807
ET = cast<VectorType> (TP)->getElementType();
806808
break;
809+
case Type::ExtVector:
810+
ET = cast<ExtVectorType>(TP)->getElementType();
811+
break;
807812
case Type::Complex:
808813
ET = cast<ComplexType> (TP)->getElementType();
809814
break;
@@ -827,6 +832,9 @@ long long clang_getNumElements(CXType CT) {
827832
case Type::Vector:
828833
result = cast<VectorType> (TP)->getNumElements();
829834
break;
835+
case Type::ExtVector:
836+
result = cast<ExtVectorType>(TP)->getNumElements();
837+
break;
830838
default:
831839
break;
832840
}

0 commit comments

Comments
 (0)