translate-c: support brace-enclosed string initializers (c++20 9.4.2.1)

This commit is contained in:
kcbanner
2023-04-22 02:11:16 -04:00
committed by Veikka Tuominen
parent bc8e1e1de4
commit 42ee364e7b
5 changed files with 61 additions and 8 deletions

View File

@@ -2382,6 +2382,12 @@ bool ZigClangExpr_EvaluateAsConstantExpr(const ZigClangExpr *self, ZigClangExprE
return true;
}
const ZigClangStringLiteral *ZigClangExpr_castToStringLiteral(const struct ZigClangExpr *self) {
auto casted_self = reinterpret_cast<const clang::Expr *>(self);
auto cast = clang::dyn_cast<const clang::StringLiteral>(casted_self);
return reinterpret_cast<const ZigClangStringLiteral *>(cast);
}
const ZigClangExpr *ZigClangInitListExpr_getInit(const ZigClangInitListExpr *self, unsigned i) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
const clang::Expr *result = casted->getInit(i);
@@ -2394,6 +2400,16 @@ const ZigClangExpr *ZigClangInitListExpr_getArrayFiller(const ZigClangInitListEx
return reinterpret_cast<const ZigClangExpr *>(result);
}
bool ZigClangInitListExpr_hasArrayFiller(const ZigClangInitListExpr *self) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
return casted->hasArrayFiller();
}
bool ZigClangInitListExpr_isStringLiteralInit(const ZigClangInitListExpr *self) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
return casted->isStringLiteralInit();
}
const ZigClangFieldDecl *ZigClangInitListExpr_getInitializedFieldInUnion(const ZigClangInitListExpr *self) {
auto casted = reinterpret_cast<const clang::InitListExpr *>(self);
const clang::FieldDecl *result = casted->getInitializedFieldInUnion();