@@ -22,7 +22,7 @@ public class CppTypePrinter : TypePrinter
2222 public bool PrintTypeModifiers { get ; set ; }
2323 public bool PrintVariableArrayAsPointers { get ; set ; }
2424
25- public CppTypePrinter ( BindingContext context ) : base ( TypePrinterContextKind . Managed )
25+ public CppTypePrinter ( BindingContext context ) : base ( TypePrinterContextKind . Native )
2626 {
2727 Context = context ;
2828 PrintFlavorKind = CppTypePrintFlavorKind . Cpp ;
@@ -436,11 +436,25 @@ public TypePrinterResult GetDeclName(Declaration declaration,
436436 {
437437 case TypePrintScopeKind . Local :
438438 {
439+ if ( ContextKind == TypePrinterContextKind . Managed )
440+ {
441+ return PrintLogicalNames ? declaration . LogicalName : declaration . Name ;
442+ }
443+
439444 return PrintLogicalNames ? declaration . LogicalOriginalName
440445 : declaration . OriginalName ;
441446 }
442447 case TypePrintScopeKind . Qualified :
443448 {
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+
444458 if ( declaration . Namespace is Class )
445459 return $ "{ declaration . Namespace . Visit ( this ) } ::{ declaration . OriginalName } ";
446460
@@ -449,8 +463,11 @@ public TypePrinterResult GetDeclName(Declaration declaration,
449463 }
450464 case TypePrintScopeKind . GlobalQualified :
451465 {
466+ var name = ( ContextKind == TypePrinterContextKind . Managed ) ?
467+ declaration . Name : declaration . OriginalName ;
468+
452469 if ( declaration . Namespace is Class )
453- return $ "{ declaration . Namespace . Visit ( this ) } ::{ declaration . OriginalName } ";
470+ return $ "{ declaration . Namespace . Visit ( this ) } ::{ name } ";
454471
455472 var qualifier = PrintFlavorKind == CppTypePrintFlavorKind . Cpp ? "::" : string . Empty ;
456473 return qualifier + GetDeclName ( declaration , TypePrintScopeKind . Qualified ) ;
0 commit comments