Skip to content

Commit 6a414f3

Browse files
committed
Fix SymbolCodeGenerator printing typed enums as normal typeless integers
1 parent a642691 commit 6a414f3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/CppParser/Parser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,12 @@ Parser::WalkTemplateArgument(const clang::TemplateArgument& TA,
15371537
case clang::TemplateArgument::Integral:
15381538
Arg.kind = CppSharp::CppParser::TemplateArgument::ArgumentKind::Integral;
15391539
//Arg.Type = WalkType(TA.getIntegralType(), 0);
1540+
{
1541+
clang::TypeLoc ArgTL;
1542+
if (ArgLoc && ArgLoc->getTypeSourceInfo())
1543+
ArgTL = ArgLoc->getTypeSourceInfo()->getTypeLoc();
1544+
Arg.type = GetQualifiedType(TA.getIntegralType(), &ArgTL);
1545+
}
15401546
Arg.integral = TA.getAsIntegral().getLimitedValue();
15411547
break;
15421548
case clang::TemplateArgument::Template:

src/Generator/Passes/SymbolsCodeGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private IEnumerable<string> GetTemplateArguments(
307307
case TemplateArgument.ArgumentKind.Declaration:
308308
return a.Declaration.Visit(cppTypePrinter).ToString();
309309
case TemplateArgument.ArgumentKind.Integral:
310-
return a.Integral.ToString(CultureInfo.InvariantCulture);
310+
return ("(" + a.Type.Visit(cppTypePrinter) + ")") + a.Integral.ToString(CultureInfo.InvariantCulture);
311311
}
312312
throw new System.ArgumentOutOfRangeException(
313313
nameof(a.Kind), a.Kind, "Unsupported kind of template argument.");

0 commit comments

Comments
 (0)