@@ -264,7 +264,7 @@ bool Converter::VisitConstantArrayType(clang::ConstantArrayType *type) {
264264bool Converter::VisitIncompleteArrayType (clang::IncompleteArrayType *type) {
265265 StrCat (' [' );
266266 Convert (type->getElementType ());
267- StrCat (' ] ' );
267+ StrCat (" ; 0] " );
268268 return false ;
269269}
270270
@@ -1193,14 +1193,7 @@ bool Converter::VisitFieldDecl(clang::FieldDecl *decl) {
11931193 auto access_spec = AccessSpecifierAsString (decl->getAccess ());
11941194 auto field_name = GetNamedDeclAsString (decl);
11951195 StrCat (access_spec, std::move (field_name), token::kColon );
1196- if (auto *array = ctx_.getAsIncompleteArrayType (decl->getType ());
1197- array && EmitsReprCForRecords ()) {
1198- StrCat (' [' );
1199- Convert (array->getElementType ());
1200- StrCat (" ; 0]" );
1201- } else {
1202- Convert (decl->getType ());
1203- }
1196+ Convert (decl->getType ());
12041197 StrCat (token::kComma );
12051198 return false ;
12061199}
@@ -4054,10 +4047,6 @@ bool Converter::VisitCXXStdInitializerListExpr(
40544047}
40554048
40564049std::string Converter::GetArrayDefaultAsString (clang::QualType qual_type) {
4057- if (clang::isa<clang::IncompleteArrayType>(qual_type) &&
4058- EmitsReprCForRecords ()) {
4059- return " []" ;
4060- }
40614050 if (auto *array_type = clang::dyn_cast<clang::ConstantArrayType>(qual_type)) {
40624051 auto size_as_string = GetNumAsString (array_type->getSize ());
40634052 auto element_type = array_type->getElementType ();
@@ -4071,9 +4060,8 @@ std::string Converter::GetArrayDefaultAsString(clang::QualType qual_type) {
40714060 return std::format (" [{}; {}]" , element_type_as_string,
40724061 size_as_string.c_str ());
40734062 }
4074- if (auto *array_type =
4075- clang::dyn_cast<clang::IncompleteArrayType>(qual_type)) {
4076- return GetDefaultAsString (array_type->getElementType ());
4063+ if (clang::isa<clang::IncompleteArrayType>(qual_type)) {
4064+ return " []" ;
40774065 }
40784066 if (Printer::ToString (ctx_, qual_type).contains (" std::array" )) {
40794067 assert (GetTemplateArgs (qual_type).has_value ());
0 commit comments