aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2019-12-13 14:55:36 +0200
committerVexu <git@vexu.eu>2019-12-13 15:07:10 +0200
commiteb057ef41c8a5482586fc39bab11c280e261ea94 (patch)
tree2d2b3564a10210644bee16a6647b8961017e0db7 /src
parent0795f17db23fff5aada41008348a63cbc9e0321b (diff)
downloadzig-eb057ef41c8a5482586fc39bab11c280e261ea94.tar.gz
zig-eb057ef41c8a5482586fc39bab11c280e261ea94.zip
translate-c-2 dont eval init expr
Diffstat (limited to 'src')
-rw-r--r--src/zig_clang.cpp22
-rw-r--r--src/zig_clang.h6
2 files changed, 28 insertions, 0 deletions
diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp
index 3c04a2dc8a..86ef17ffbe 100644
--- a/src/zig_clang.cpp
+++ b/src/zig_clang.cpp
@@ -1825,6 +1825,23 @@ bool ZigClangExpr_EvaluateAsConstantExpr(const ZigClangExpr *self, ZigClangExprE
return true;
}
+const ZigClangExpr *ZigClangInitListExpr_getInit(const ZigClangInitListExpr *self, unsigned i) {
+ auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
+ const clang::Expr *result = casted->getInit(i);
+ return reinterpret_cast<const ZigClangExpr *>(result);
+}
+
+const ZigClangExpr *ZigClangInitListExpr_getArrayFiller(const ZigClangInitListExpr *self) {
+ auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
+ const clang::Expr *result = casted->getArrayFiller();
+ return reinterpret_cast<const ZigClangExpr *>(result);
+}
+
+unsigned ZigClangInitListExpr_getNumInits(const ZigClangInitListExpr *self) {
+ auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
+ return casted->getNumInits();
+}
+
ZigClangAPValueKind ZigClangAPValue_getKind(const ZigClangAPValue *self) {
auto casted = reinterpret_cast<const clang::APValue *>(self);
return (ZigClangAPValueKind)casted->getKind();
@@ -2065,6 +2082,11 @@ const ZigClangAPValue * ZigClangVarDecl_evaluateValue(const struct ZigClangVarDe
return reinterpret_cast<const ZigClangAPValue *>(result);
}
+enum ZigClangStorageClass ZigClangVarDecl_getStorageClass(const struct ZigClangVarDecl *self) {
+ auto casted = reinterpret_cast<const clang::VarDecl *>(self);
+ return (ZigClangStorageClass)casted->getStorageClass();
+}
+
enum ZigClangBuiltinTypeKind ZigClangBuiltinType_getKind(const struct ZigClangBuiltinType *self) {
auto casted = reinterpret_cast<const clang::BuiltinType *>(self);
return (ZigClangBuiltinTypeKind)casted->getKind();
diff --git a/src/zig_clang.h b/src/zig_clang.h
index c4c5c378eb..cf60fdfca9 100644
--- a/src/zig_clang.h
+++ b/src/zig_clang.h
@@ -144,6 +144,7 @@ struct ZigClangUnaryOperator;
struct ZigClangValueDecl;
struct ZigClangVarDecl;
struct ZigClangWhileStmt;
+struct ZigClangInitListExpr;
typedef struct ZigClangStmt *const * ZigClangCompoundStmt_const_body_iterator;
typedef struct ZigClangDecl *const * ZigClangDeclStmt_const_decl_iterator;
@@ -904,6 +905,7 @@ ZIG_EXTERN_C bool ZigClangVarDecl_isFileVarDecl(const struct ZigClangVarDecl *);
ZIG_EXTERN_C bool ZigClangVarDecl_hasInit(const struct ZigClangVarDecl *);
ZIG_EXTERN_C const struct ZigClangAPValue *ZigClangVarDecl_evaluateValue(const struct ZigClangVarDecl *);
ZIG_EXTERN_C struct ZigClangQualType ZigClangVarDecl_getTypeSourceInfo_getType(const struct ZigClangVarDecl *);
+ZIG_EXTERN_C enum ZigClangStorageClass ZigClangVarDecl_getStorageClass(const struct ZigClangVarDecl *self);
ZIG_EXTERN_C bool ZigClangSourceLocation_eq(struct ZigClangSourceLocation a, struct ZigClangSourceLocation b);
@@ -939,6 +941,10 @@ ZIG_EXTERN_C bool ZigClangExpr_EvaluateAsFloat(const struct ZigClangExpr *self,
ZIG_EXTERN_C bool ZigClangExpr_EvaluateAsConstantExpr(const struct ZigClangExpr *,
struct ZigClangExprEvalResult *, ZigClangExpr_ConstExprUsage, const struct ZigClangASTContext *);
+ZIG_EXTERN_C const ZigClangExpr *ZigClangInitListExpr_getInit(const ZigClangInitListExpr *, unsigned);
+ZIG_EXTERN_C const ZigClangExpr *ZigClangInitListExpr_getArrayFiller(const ZigClangInitListExpr *);
+ZIG_EXTERN_C unsigned ZigClangInitListExpr_getNumInits(const ZigClangInitListExpr *);
+
ZIG_EXTERN_C enum ZigClangAPValueKind ZigClangAPValue_getKind(const struct ZigClangAPValue *self);
ZIG_EXTERN_C const struct ZigClangAPSInt *ZigClangAPValue_getInt(const struct ZigClangAPValue *self);
ZIG_EXTERN_C unsigned ZigClangAPValue_getArrayInitializedElts(const struct ZigClangAPValue *self);