Skip to content

Commit 1ad118c

Browse files
committed
Fix type printing of typedef qualifiers in C++ type printer.
1 parent 64a99cc commit 1ad118c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Generator/Generators/C/CppTypePrinter.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,15 @@ public override TypePrinterResult VisitTypedefType(TypedefType typedef,
204204
if (ResolveTypedefs && !typedef.Declaration.Type.IsPointerTo(out func))
205205
{
206206
TypePrinterResult type = typedef.Declaration.QualifiedType.Visit(this);
207-
return new TypePrinterResult { Type = $"{qual}{type.Type}", NamePrefix = type.NamePrefix, NameSuffix = type.NameSuffix };
207+
return new TypePrinterResult { Type = $"{qual}{type.Type}",
208+
NamePrefix = type.NamePrefix, NameSuffix = type.NameSuffix };
208209
}
209-
return $"{qual}{typedef.Declaration.Visit(this)}";
210+
211+
var result = typedef.Declaration.Visit(this);
212+
if (result.NamePrefix.Length > 0)
213+
result.NamePrefix.Append($"{qual}");
214+
215+
return result;
210216
}
211217

212218
public override TypePrinterResult VisitAttributedType(AttributedType attributed,

0 commit comments

Comments
 (0)