@@ -22,7 +22,7 @@ public class CppTypePrinter : TypePrinter
22
22
public bool PrintTypeModifiers { get ; set ; }
23
23
public bool PrintVariableArrayAsPointers { get ; set ; }
24
24
25
- public CppTypePrinter ( BindingContext context ) : base ( TypePrinterContextKind . Managed )
25
+ public CppTypePrinter ( BindingContext context ) : base ( TypePrinterContextKind . Native )
26
26
{
27
27
Context = context ;
28
28
PrintFlavorKind = CppTypePrintFlavorKind . Cpp ;
@@ -436,11 +436,25 @@ public TypePrinterResult GetDeclName(Declaration declaration,
436
436
{
437
437
case TypePrintScopeKind . Local :
438
438
{
439
+ if ( ContextKind == TypePrinterContextKind . Managed )
440
+ {
441
+ return PrintLogicalNames ? declaration . LogicalName : declaration . Name ;
442
+ }
443
+
439
444
return PrintLogicalNames ? declaration . LogicalOriginalName
440
445
: declaration . OriginalName ;
441
446
}
442
447
case TypePrintScopeKind . Qualified :
443
448
{
449
+ if ( ContextKind == TypePrinterContextKind . Managed )
450
+ {
451
+ var outputNamespace = declaration . TranslationUnit ? . Module ? . OutputNamespace ;
452
+ if ( ! string . IsNullOrEmpty ( outputNamespace ) )
453
+ return $ "{ outputNamespace } ::{ declaration . QualifiedName } ";
454
+
455
+ return declaration . QualifiedName ;
456
+ }
457
+
444
458
if ( declaration . Namespace is Class )
445
459
return $ "{ declaration . Namespace . Visit ( this ) } ::{ declaration . OriginalName } ";
446
460
@@ -449,8 +463,11 @@ public TypePrinterResult GetDeclName(Declaration declaration,
449
463
}
450
464
case TypePrintScopeKind . GlobalQualified :
451
465
{
466
+ var name = ( ContextKind == TypePrinterContextKind . Managed ) ?
467
+ declaration . Name : declaration . OriginalName ;
468
+
452
469
if ( declaration . Namespace is Class )
453
- return $ "{ declaration . Namespace . Visit ( this ) } ::{ declaration . OriginalName } ";
470
+ return $ "{ declaration . Namespace . Visit ( this ) } ::{ name } ";
454
471
455
472
var qualifier = PrintFlavorKind == CppTypePrintFlavorKind . Cpp ? "::" : string . Empty ;
456
473
return qualifier + GetDeclName ( declaration , TypePrintScopeKind . Qualified ) ;
0 commit comments