TypeKind.INCOMPLETEARRAY = TypeKind(114)
TypeKind.VARIABLEARRAY = TypeKind(115)
TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116)
+TypeKind.MEMBERPOINTER = TypeKind(117)
class Type(Structure):
"""
"""
return conf.lib.clang_getArraySize(self)
+ def get_class_type(self):
+ """
+ Retrieve the class type of the member pointer type.
+ """
+ return conf.lib.clang_Type_getClassType(self)
+
def get_align(self):
"""
Retrieve the alignment of the record.
[Type],
c_longlong),
+ ("clang_Type_getClassType",
+ [Type],
+ Type,
+ Type.from_result),
+
("clang_getFieldDeclBitWidth",
[Cursor],
c_int),
CXType_Vector = 113,
CXType_IncompleteArray = 114,
CXType_VariableArray = 115,
- CXType_DependentSizedArray = 116
+ CXType_DependentSizedArray = 116,
+ CXType_MemberPointer = 117
};
/**
*/
CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);
+/**
+ * \brief Return the class type of an member pointer type.
+ *
+ * If a non-member-pointer type is passed in, an invalid type is returned.
+ */
+CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T);
+
/**
* \brief Return the size of a type in bytes as per C++[expr.sizeof] standard.
*
void foo(int i, int incomplete_array[]) { int variable_array[i]; }
+struct Blob {
+ int i;
+};
+int Blob::*member_pointer;
+
// RUN: c-index-test -test-print-type %s | FileCheck %s
// CHECK: Namespace=outer:1:11 (Definition) [type=] [typekind=Invalid] [isPOD=0]
// CHECK: ClassTemplate=Foo:4:8 (Definition) [type=] [typekind=Invalid] [isPOD=0]
// CHECK: ParmDecl=:33:11 (Definition) [type=int [size]] [typekind=DependentSizedArray] [isPOD=0]
// CHECK: ParmDecl=incomplete_array:35:21 (Definition) [type=int []] [typekind=IncompleteArray] [isPOD=1]
// CHECK: VarDecl=variable_array:35:47 (Definition) [type=int [i]] [typekind=VariableArray] [isPOD=1]
+// CHECK: VarDecl=member_pointer:40:12 (Definition) [type=int Blob::*] [typekind=MemberPointer] [isPOD=1]
TKCASE(VariableArray);
TKCASE(DependentSizedArray);
TKCASE(Vector);
+ TKCASE(MemberPointer);
default:
return CXType_Unexposed;
}
case Type::ObjCObjectPointer:
T = cast<ObjCObjectPointerType>(TP)->getPointeeType();
break;
+ case Type::MemberPointer:
+ T = cast<MemberPointerType>(TP)->getPointeeType();
+ break;
default:
T = QualType();
break;
TKIND(VariableArray);
TKIND(DependentSizedArray);
TKIND(Vector);
+ TKIND(MemberPointer);
}
#undef TKIND
return cxstring::createRef(s);
return Ctx.getTypeAlignInChars(QT).getQuantity();
}
+CXType clang_Type_getClassType(CXType CT) {
+ QualType ET = QualType();
+ QualType T = GetQualType(CT);
+ const Type *TP = T.getTypePtrOrNull();
+
+ if (TP && TP->getTypeClass() == Type::MemberPointer) {
+ ET = QualType(cast<MemberPointerType> (TP)->getClass(), 0);
+ }
+ return MakeCXType(ET, GetTU(CT));
+}
+
long long clang_Type_getSizeOf(CXType T) {
if (T.kind == CXType_Invalid)
return CXTypeLayoutError_Invalid;
clang_TParamCommandComment_getDepth
clang_TParamCommandComment_getIndex
clang_Type_getAlignOf
+clang_Type_getClassType
clang_Type_getSizeOf
clang_Type_getOffsetOf
clang_VerbatimBlockLineComment_getText