Implement missing clang functions from last commit

This commit is contained in:
hryx 2019-05-29 15:33:44 -07:00
parent e632c2ade3
commit 3e14f86f9e
No known key found for this signature in database
GPG Key ID: 6A2784E15D7D95D6
4 changed files with 36 additions and 2 deletions

View File

@ -479,6 +479,7 @@ pub extern fn ZigClangSourceLocation_eq(a: struct_ZigClangSourceLocation, b: str
pub extern fn ZigClangTypedefType_getDecl(arg0: ?*const struct_ZigClangTypedefType) ?*const struct_ZigClangTypedefNameDecl;
pub extern fn ZigClangTypedefNameDecl_getUnderlyingType(arg0: ?*const struct_ZigClangTypedefNameDecl) struct_ZigClangQualType;
pub extern fn ZigClangQualType_getCanonicalType(arg0: struct_ZigClangQualType) struct_ZigClangQualType;
pub extern fn ZigClangQualType_getTypeClass(self: struct_ZigClangQualType) ZigClangTypeClass;
pub extern fn ZigClangQualType_getTypePtr(self: struct_ZigClangQualType) *const struct_ZigClangType;
pub extern fn ZigClangQualType_addConst(arg0: [*c]struct_ZigClangQualType) void;
pub extern fn ZigClangQualType_eq(arg0: struct_ZigClangQualType, arg1: struct_ZigClangQualType) bool;
@ -887,3 +888,9 @@ pub extern fn ZigClangImplicitCastExpr_getSubExpr(*const ZigClangImplicitCastExp
pub extern fn ZigClangArrayType_getElementType(*const ZigClangArrayType) ZigClangQualType;
pub extern fn ZigClangDeclRefExpr_getDecl(*const ZigClangDeclRefExpr) *const ZigClangValueDecl;
pub extern fn ZigClangParenType_getInnerType(*const ZigClangParenType) ZigClangQualType;
pub extern fn ZigClangElaboratedType_getNamedType(*const ZigClangElaboratedType) ZigClangQualType;
pub extern fn ZigClangAttributedType_getEquivalentType(*const ZigClangAttributedType) ZigClangQualType;

View File

@ -638,12 +638,12 @@ fn qualTypeChildIsFnProto(qt: ZigClangQualType) bool {
const ty = ZigClangQualType_getTypePtr(qt);
if (ZigClangType_getTypeClass(ty) == .Paren) {
const paren_type = @ptrCast(*const ZigClangParenType, ty);
const inner_type = ZigClangParenType_getInnerType(ty);
const inner_type = ZigClangParenType_getInnerType(paren_type);
return ZigClangQualType_getTypeClass(inner_type) == .FunctionProto;
}
if (ZigClangType_getTypeClass(ty) == .Attributed) {
const attr_type = @ptrCast(*const ZigClangAttributedType, ty);
return qualTypeChildIsFnProto(bitcast(ZigClangAttributedType_getEquivalentType(attr_type)));
return qualTypeChildIsFnProto(ZigClangAttributedType_getEquivalentType(attr_type));
}
return false;
}

View File

@ -1546,6 +1546,11 @@ const ZigClangType *ZigClangQualType_getTypePtr(ZigClangQualType self) {
return reinterpret_cast<const ZigClangType *>(ty);
}
ZigClangTypeClass ZigClangQualType_getTypeClass(ZigClangQualType self) {
clang::QualType ty = bitcast(self);
return (ZigClangTypeClass)(ty->getTypeClass());
}
void ZigClangQualType_addConst(ZigClangQualType *self) {
reinterpret_cast<clang::QualType *>(self)->addConst();
}
@ -1944,3 +1949,18 @@ const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClan
auto casted = reinterpret_cast<const clang::DeclRefExpr *>(self);
return reinterpret_cast<const struct ZigClangValueDecl *>(casted->getDecl());
}
struct ZigClangQualType ZigClangParenType_getInnerType(const struct ZigClangParenType *self) {
auto casted = reinterpret_cast<const clang::ParenType *>(self);
return bitcast(casted->getInnerType());
}
struct ZigClangQualType ZigClangAttributedType_getEquivalentType(const struct ZigClangAttributedType *self) {
auto casted = reinterpret_cast<const clang::AttributedType *>(self);
return bitcast(casted->getEquivalentType());
}
struct ZigClangQualType ZigClangElaboratedType_getNamedType(const struct ZigClangElaboratedType *self) {
auto casted = reinterpret_cast<const clang::ElaboratedType *>(self);
return bitcast(casted->getNamedType());
}

View File

@ -807,6 +807,7 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangTypedefNameDecl_getUnderlyingType(c
ZIG_EXTERN_C struct ZigClangQualType ZigClangQualType_getCanonicalType(struct ZigClangQualType);
ZIG_EXTERN_C const struct ZigClangType *ZigClangQualType_getTypePtr(struct ZigClangQualType);
ZIG_EXTERN_C enum ZigClangTypeClass ZigClangQualType_getTypeClass(struct ZigClangQualType);
ZIG_EXTERN_C void ZigClangQualType_addConst(struct ZigClangQualType *);
ZIG_EXTERN_C bool ZigClangQualType_eq(struct ZigClangQualType, struct ZigClangQualType);
ZIG_EXTERN_C bool ZigClangQualType_isConstQualified(struct ZigClangQualType);
@ -878,4 +879,10 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangArrayType_getElementType(const stru
ZIG_EXTERN_C const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClangDeclRefExpr *);
ZIG_EXTERN_C struct ZigClangQualType ZigClangParenType_getInnerType(const struct ZigClangParenType *);
ZIG_EXTERN_C struct ZigClangQualType ZigClangAttributedType_getEquivalentType(const struct ZigClangAttributedType *);
ZIG_EXTERN_C struct ZigClangQualType ZigClangElaboratedType_getNamedType(const struct ZigClangElaboratedType *);
#endif