diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-01-02 17:47:53 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-02 14:16:39 -0500 |
| commit | b0fa2ff85334c2af626a313bb3254ce741435d55 (patch) | |
| tree | 555b2f0b2ba5560adecadb6a11e34606e2c13997 /src/zig_clang.cpp | |
| parent | 197509e1ec2d475fe646b3e1cde66a23df2520b3 (diff) | |
| download | zig-b0fa2ff85334c2af626a313bb3254ce741435d55.tar.gz zig-b0fa2ff85334c2af626a313bb3254ce741435d55.zip | |
Translate struct/union initializer expressions
Diffstat (limited to 'src/zig_clang.cpp')
| -rw-r--r-- | src/zig_clang.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp index c8dec14bfe..6217e17800 100644 --- a/src/zig_clang.cpp +++ b/src/zig_clang.cpp @@ -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(); |
