| author | |
| committer | |
| log | 3e14f86f9e703a4d189aab5e2f27c1029927c9e9 |
| tree | 168394c02980a979b8d3ff9410adcfde5a4acc99 |
| parent | e632c2ade3d9ea2cfaa201b20f523d315d9c47fd |
| signature | Commit is signed but in an unrecognized format. |
4 files changed, 36 insertions(+), 2 deletions(-)
src-self-hosted/clang.zig+7| ... | @@ -479,6 +479,7 @@ pub extern fn ZigClangSourceLocation_eq(a: struct_ZigClangSourceLocation, b: str | ... | @@ -479,6 +479,7 @@ pub extern fn ZigClangSourceLocation_eq(a: struct_ZigClangSourceLocation, b: str |
| 479 | pub extern fn ZigClangTypedefType_getDecl(arg0: ?*const struct_ZigClangTypedefType) ?*const struct_ZigClangTypedefNameDecl; | 479 | pub extern fn ZigClangTypedefType_getDecl(arg0: ?*const struct_ZigClangTypedefType) ?*const struct_ZigClangTypedefNameDecl; |
| 480 | pub extern fn ZigClangTypedefNameDecl_getUnderlyingType(arg0: ?*const struct_ZigClangTypedefNameDecl) struct_ZigClangQualType; | 480 | pub extern fn ZigClangTypedefNameDecl_getUnderlyingType(arg0: ?*const struct_ZigClangTypedefNameDecl) struct_ZigClangQualType; |
| 481 | pub extern fn ZigClangQualType_getCanonicalType(arg0: struct_ZigClangQualType) struct_ZigClangQualType; | 481 | pub extern fn ZigClangQualType_getCanonicalType(arg0: struct_ZigClangQualType) struct_ZigClangQualType; |
| 482 | pub extern fn ZigClangQualType_getTypeClass(self: struct_ZigClangQualType) ZigClangTypeClass; | ||
| 482 | pub extern fn ZigClangQualType_getTypePtr(self: struct_ZigClangQualType) *const struct_ZigClangType; | 483 | pub extern fn ZigClangQualType_getTypePtr(self: struct_ZigClangQualType) *const struct_ZigClangType; |
| 483 | pub extern fn ZigClangQualType_addConst(arg0: [*c]struct_ZigClangQualType) void; | 484 | pub extern fn ZigClangQualType_addConst(arg0: [*c]struct_ZigClangQualType) void; |
| 484 | pub extern fn ZigClangQualType_eq(arg0: struct_ZigClangQualType, arg1: struct_ZigClangQualType) bool; | 485 | pub extern fn ZigClangQualType_eq(arg0: struct_ZigClangQualType, arg1: struct_ZigClangQualType) bool; |
| ... | @@ -887,3 +888,9 @@ pub extern fn ZigClangImplicitCastExpr_getSubExpr(*const ZigClangImplicitCastExp | ... | @@ -887,3 +888,9 @@ pub extern fn ZigClangImplicitCastExpr_getSubExpr(*const ZigClangImplicitCastExp |
| 887 | pub extern fn ZigClangArrayType_getElementType(*const ZigClangArrayType) ZigClangQualType; | 888 | pub extern fn ZigClangArrayType_getElementType(*const ZigClangArrayType) ZigClangQualType; |
| 888 | 889 | ||
| 889 | pub extern fn ZigClangDeclRefExpr_getDecl(*const ZigClangDeclRefExpr) *const ZigClangValueDecl; | 890 | pub extern fn ZigClangDeclRefExpr_getDecl(*const ZigClangDeclRefExpr) *const ZigClangValueDecl; |
| 891 | |||
| 892 | pub extern fn ZigClangParenType_getInnerType(*const ZigClangParenType) ZigClangQualType; | ||
| 893 | |||
| 894 | pub extern fn ZigClangElaboratedType_getNamedType(*const ZigClangElaboratedType) ZigClangQualType; | ||
| 895 | |||
| 896 | pub extern fn ZigClangAttributedType_getEquivalentType(*const ZigClangAttributedType) ZigClangQualType; |
src-self-hosted/translate_c.zig+2-2| ... | @@ -638,12 +638,12 @@ fn qualTypeChildIsFnProto(qt: ZigClangQualType) bool { | ... | @@ -638,12 +638,12 @@ fn qualTypeChildIsFnProto(qt: ZigClangQualType) bool { |
| 638 | const ty = ZigClangQualType_getTypePtr(qt); | 638 | const ty = ZigClangQualType_getTypePtr(qt); |
| 639 | if (ZigClangType_getTypeClass(ty) == .Paren) { | 639 | if (ZigClangType_getTypeClass(ty) == .Paren) { |
| 640 | const paren_type = @ptrCast(*const ZigClangParenType, ty); | 640 | const paren_type = @ptrCast(*const ZigClangParenType, ty); |
| 641 | const inner_type = ZigClangParenType_getInnerType(ty); | 641 | const inner_type = ZigClangParenType_getInnerType(paren_type); |
| 642 | return ZigClangQualType_getTypeClass(inner_type) == .FunctionProto; | 642 | return ZigClangQualType_getTypeClass(inner_type) == .FunctionProto; |
| 643 | } | 643 | } |
| 644 | if (ZigClangType_getTypeClass(ty) == .Attributed) { | 644 | if (ZigClangType_getTypeClass(ty) == .Attributed) { |
| 645 | const attr_type = @ptrCast(*const ZigClangAttributedType, ty); | 645 | const attr_type = @ptrCast(*const ZigClangAttributedType, ty); |
| 646 | return qualTypeChildIsFnProto(bitcast(ZigClangAttributedType_getEquivalentType(attr_type))); | 646 | return qualTypeChildIsFnProto(ZigClangAttributedType_getEquivalentType(attr_type)); |
| 647 | } | 647 | } |
| 648 | return false; | 648 | return false; |
| 649 | } | 649 | } |
src/zig_clang.cpp+20| ... | @@ -1546,6 +1546,11 @@ const ZigClangType *ZigClangQualType_getTypePtr(ZigClangQualType self) { | ... | @@ -1546,6 +1546,11 @@ const ZigClangType *ZigClangQualType_getTypePtr(ZigClangQualType self) { |
| 1546 | return reinterpret_cast<const ZigClangType *>(ty); | 1546 | return reinterpret_cast<const ZigClangType *>(ty); |
| 1547 | } | 1547 | } |
| 1548 | 1548 | ||
| 1549 | ZigClangTypeClass ZigClangQualType_getTypeClass(ZigClangQualType self) { | ||
| 1550 | clang::QualType ty = bitcast(self); | ||
| 1551 | return (ZigClangTypeClass)(ty->getTypeClass()); | ||
| 1552 | } | ||
| 1553 | |||
| 1549 | void ZigClangQualType_addConst(ZigClangQualType *self) { | 1554 | void ZigClangQualType_addConst(ZigClangQualType *self) { |
| 1550 | reinterpret_cast<clang::QualType *>(self)->addConst(); | 1555 | reinterpret_cast<clang::QualType *>(self)->addConst(); |
| 1551 | } | 1556 | } |
| ... | @@ -1944,3 +1949,18 @@ const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClan | ... | @@ -1944,3 +1949,18 @@ const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClan |
| 1944 | auto casted = reinterpret_cast<const clang::DeclRefExpr *>(self); | 1949 | auto casted = reinterpret_cast<const clang::DeclRefExpr *>(self); |
| 1945 | return reinterpret_cast<const struct ZigClangValueDecl *>(casted->getDecl()); | 1950 | return reinterpret_cast<const struct ZigClangValueDecl *>(casted->getDecl()); |
| 1946 | } | 1951 | } |
| 1952 | |||
| 1953 | struct ZigClangQualType ZigClangParenType_getInnerType(const struct ZigClangParenType *self) { | ||
| 1954 | auto casted = reinterpret_cast<const clang::ParenType *>(self); | ||
| 1955 | return bitcast(casted->getInnerType()); | ||
| 1956 | } | ||
| 1957 | |||
| 1958 | struct ZigClangQualType ZigClangAttributedType_getEquivalentType(const struct ZigClangAttributedType *self) { | ||
| 1959 | auto casted = reinterpret_cast<const clang::AttributedType *>(self); | ||
| 1960 | return bitcast(casted->getEquivalentType()); | ||
| 1961 | } | ||
| 1962 | |||
| 1963 | struct ZigClangQualType ZigClangElaboratedType_getNamedType(const struct ZigClangElaboratedType *self) { | ||
| 1964 | auto casted = reinterpret_cast<const clang::ElaboratedType *>(self); | ||
| 1965 | return bitcast(casted->getNamedType()); | ||
| 1966 | } |
src/zig_clang.h+7| ... | @@ -807,6 +807,7 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangTypedefNameDecl_getUnderlyingType(c | ... | @@ -807,6 +807,7 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangTypedefNameDecl_getUnderlyingType(c |
| 807 | 807 | ||
| 808 | ZIG_EXTERN_C struct ZigClangQualType ZigClangQualType_getCanonicalType(struct ZigClangQualType); | 808 | ZIG_EXTERN_C struct ZigClangQualType ZigClangQualType_getCanonicalType(struct ZigClangQualType); |
| 809 | ZIG_EXTERN_C const struct ZigClangType *ZigClangQualType_getTypePtr(struct ZigClangQualType); | 809 | ZIG_EXTERN_C const struct ZigClangType *ZigClangQualType_getTypePtr(struct ZigClangQualType); |
| 810 | ZIG_EXTERN_C enum ZigClangTypeClass ZigClangQualType_getTypeClass(struct ZigClangQualType); | ||
| 810 | ZIG_EXTERN_C void ZigClangQualType_addConst(struct ZigClangQualType *); | 811 | ZIG_EXTERN_C void ZigClangQualType_addConst(struct ZigClangQualType *); |
| 811 | ZIG_EXTERN_C bool ZigClangQualType_eq(struct ZigClangQualType, struct ZigClangQualType); | 812 | ZIG_EXTERN_C bool ZigClangQualType_eq(struct ZigClangQualType, struct ZigClangQualType); |
| 812 | ZIG_EXTERN_C bool ZigClangQualType_isConstQualified(struct ZigClangQualType); | 813 | ZIG_EXTERN_C bool ZigClangQualType_isConstQualified(struct ZigClangQualType); |
| ... | @@ -878,4 +879,10 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangArrayType_getElementType(const stru | ... | @@ -878,4 +879,10 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangArrayType_getElementType(const stru |
| 878 | 879 | ||
| 879 | ZIG_EXTERN_C const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClangDeclRefExpr *); | 880 | ZIG_EXTERN_C const struct ZigClangValueDecl *ZigClangDeclRefExpr_getDecl(const struct ZigClangDeclRefExpr *); |
| 880 | 881 | ||
| 882 | ZIG_EXTERN_C struct ZigClangQualType ZigClangParenType_getInnerType(const struct ZigClangParenType *); | ||
| 883 | |||
| 884 | ZIG_EXTERN_C struct ZigClangQualType ZigClangAttributedType_getEquivalentType(const struct ZigClangAttributedType *); | ||
| 885 | |||
| 886 | ZIG_EXTERN_C struct ZigClangQualType ZigClangElaboratedType_getNamedType(const struct ZigClangElaboratedType *); | ||
| 887 | |||
| 881 | #endif | 888 | #endif |