@@ -781,6 +781,9 @@ void WriteStructureValue (GeneratorWriteContext context, StructureInstance? inst
781
781
782
782
for ( int i = 0 ; i < info . Members . Count ; i ++ ) {
783
783
StructureMemberInfo smi = info . Members [ i ] ;
784
+ if ( ! smi . IsSupportedForTarget ( context . Target ) ) {
785
+ continue ;
786
+ }
784
787
785
788
context . Output . Write ( context . CurrentIndent ) ;
786
789
WriteType ( context , instance , smi , out _ ) ;
@@ -810,7 +813,7 @@ void WriteStructureValue (GeneratorWriteContext context, StructureInstance? inst
810
813
var sb = new StringBuilder ( " " ) ;
811
814
sb . Append ( MapManagedTypeToNative ( context , smi ) ) ;
812
815
sb . Append ( ' ' ) ;
813
- sb . Append ( smi . Info . Name ) ;
816
+ sb . Append ( smi . MappedName ) ;
814
817
comment = sb . ToString ( ) ;
815
818
}
816
819
WriteCommentLine ( context , comment ) ;
@@ -848,6 +851,7 @@ void WriteArrayEntries (GeneratorWriteContext context, LlvmIrVariable variable,
848
851
bool ignoreComments = stride > 1 ;
849
852
string ? prevItemComment = null ;
850
853
ulong counter = 0 ;
854
+ bool writeStringInComment = ! ignoreComments && ( elementType == typeof ( string ) || elementType == typeof ( StringHolder ) ) ;
851
855
852
856
if ( entries != null ) {
853
857
foreach ( object entry in entries ) {
@@ -871,7 +875,13 @@ void WriteArrayEntries (GeneratorWriteContext context, LlvmIrVariable variable,
871
875
}
872
876
873
877
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 } ";
875
885
}
876
886
}
877
887
@@ -1098,6 +1108,10 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si)
1098
1108
context . IncreaseIndent ( ) ;
1099
1109
for ( int i = 0 ; i < si . Members . Count ; i ++ ) {
1100
1110
StructureMemberInfo info = si . Members [ i ] ;
1111
+ if ( ! info . IsSupportedForTarget ( context . Target ) ) {
1112
+ continue ;
1113
+ }
1114
+
1101
1115
string nativeType = MapManagedTypeToNative ( info . MemberType ) ;
1102
1116
1103
1117
// TODO: nativeType can be an array, update to indicate that (and get the size)
@@ -1108,7 +1122,7 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si)
1108
1122
arraySize = String . Empty ;
1109
1123
}
1110
1124
1111
- var comment = $ " { nativeType } { info . Info . Name } { arraySize } ";
1125
+ var comment = $ " { nativeType } { info . MappedName } { arraySize } ";
1112
1126
WriteStructureDeclarationField ( info . IRType , comment , i == si . Members . Count - 1 ) ;
1113
1127
}
1114
1128
context . DecreaseIndent ( ) ;
0 commit comments