Translate struct/union initializer expressions

This commit is contained in:
LemonBoy
2020-01-02 17:47:53 +01:00
committed by Andrew Kelley
parent 197509e1ec
commit b0fa2ff853
5 changed files with 197 additions and 10 deletions

View File

@@ -1825,6 +1825,18 @@ const ZigClangArrayType *ZigClangType_getAsArrayTypeUnsafe(const ZigClangType *s
return reinterpret_cast<const ZigClangArrayType *>(result);
}
const ZigClangRecordType *ZigClangType_getAsRecordType(const ZigClangType *self) {
auto casted = reinterpret_cast<const clang::Type *>(self);
const clang::RecordType *result = casted->getAsStructureType();
return reinterpret_cast<const ZigClangRecordType *>(result);
}
const ZigClangRecordType *ZigClangType_getAsUnionType(const ZigClangType *self) {
auto casted = reinterpret_cast<const clang::Type *>(self);
const clang::RecordType *result = casted->getAsUnionType();
return reinterpret_cast<const ZigClangRecordType *>(result);
}
ZigClangSourceLocation ZigClangStmt_getBeginLoc(const ZigClangStmt *self) {
auto casted = reinterpret_cast<const clang::Stmt *>(self);
return bitcast(casted->getBeginLoc());
@@ -1898,6 +1910,12 @@ const ZigClangExpr *ZigClangInitListExpr_getArrayFiller(const ZigClangInitListEx
return reinterpret_cast<const ZigClangExpr *>(result);
}
const ZigClangFieldDecl *ZigClangInitListExpr_getInitializedFieldInUnion(const ZigClangInitListExpr *self) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
const clang::FieldDecl *result = casted->getInitializedFieldInUnion();
return reinterpret_cast<const ZigClangFieldDecl *>(result);
}
unsigned ZigClangInitListExpr_getNumInits(const ZigClangInitListExpr *self) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
return casted->getNumInits();