@@ -781,6 +781,9 @@ void WriteStructureValue (GeneratorWriteContext context, StructureInstance? inst
781781
782782 for ( int i = 0 ; i < info . Members . Count ; i ++ ) {
783783 StructureMemberInfo smi = info . Members [ i ] ;
784+ if ( ! smi . IsSupportedForTarget ( context . Target ) ) {
785+ continue ;
786+ }
784787
785788 context . Output . Write ( context . CurrentIndent ) ;
786789 WriteType ( context , instance , smi , out _ ) ;
@@ -810,7 +813,7 @@ void WriteStructureValue (GeneratorWriteContext context, StructureInstance? inst
810813 var sb = new StringBuilder ( " " ) ;
811814 sb . Append ( MapManagedTypeToNative ( context , smi ) ) ;
812815 sb . Append ( ' ' ) ;
813- sb . Append ( smi . Info . Name ) ;
816+ sb . Append ( smi . MappedName ) ;
814817 comment = sb . ToString ( ) ;
815818 }
816819 WriteCommentLine ( context , comment ) ;
@@ -848,6 +851,7 @@ void WriteArrayEntries (GeneratorWriteContext context, LlvmIrVariable variable,
848851 bool ignoreComments = stride > 1 ;
849852 string ? prevItemComment = null ;
850853 ulong counter = 0 ;
854+ bool writeStringInComment = ! ignoreComments && ( elementType == typeof ( string ) || elementType == typeof ( StringHolder ) ) ;
851855
852856 if ( entries != null ) {
853857 foreach ( object entry in entries ) {
@@ -871,7 +875,13 @@ void WriteArrayEntries (GeneratorWriteContext context, LlvmIrVariable variable,
871875 }
872876
873877 if ( writeIndices && String . IsNullOrEmpty ( prevItemComment ) ) {
874- prevItemComment = $ " { counter } ";
878+ string stringComment = String . Empty ;
879+ if ( writeStringInComment ) {
880+ var holder = StringHolder . AsHolder ( entry ) ;
881+ stringComment = $ " ('{ holder . Data } ')";
882+ }
883+
884+ prevItemComment = $ " { counter } { stringComment } ";
875885 }
876886 }
877887
@@ -1098,6 +1108,10 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si)
10981108 context . IncreaseIndent ( ) ;
10991109 for ( int i = 0 ; i < si . Members . Count ; i ++ ) {
11001110 StructureMemberInfo info = si . Members [ i ] ;
1111+ if ( ! info . IsSupportedForTarget ( context . Target ) ) {
1112+ continue ;
1113+ }
1114+
11011115 string nativeType = MapManagedTypeToNative ( info . MemberType ) ;
11021116
11031117 // TODO: nativeType can be an array, update to indicate that (and get the size)
@@ -1108,7 +1122,7 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si)
11081122 arraySize = String . Empty ;
11091123 }
11101124
1111- var comment = $ " { nativeType } { info . Info . Name } { arraySize } ";
1125+ var comment = $ " { nativeType } { info . MappedName } { arraySize } ";
11121126 WriteStructureDeclarationField ( info . IRType , comment , i == si . Members . Count - 1 ) ;
11131127 }
11141128 context . DecreaseIndent ( ) ;
0 commit comments