diff --git a/src/AST/Type.cs b/src/AST/Type.cs
index 8399f445..0398c657 100644
--- a/src/AST/Type.cs
+++ b/src/AST/Type.cs
@@ -36,6 +36,12 @@ namespace CppSharp.AST
public abstract object Clone();
}
+ public enum TypeQualifiersMode : byte
+ {
+ Default,
+ Native
+ }
+
///
/// Represents C++ type qualifiers.
///
@@ -44,10 +50,11 @@ namespace CppSharp.AST
public bool IsConst;
public bool IsVolatile;
public bool IsRestrict;
+ public TypeQualifiersMode Mode;
public override int GetHashCode() =>
IsConst.GetHashCode() ^ IsVolatile.GetHashCode() ^
- IsRestrict.GetHashCode();
+ IsRestrict.GetHashCode() ^ Mode.GetHashCode();
}
///
@@ -68,8 +75,8 @@ namespace CppSharp.AST
Qualifiers = qualifiers;
}
- public Type Type { get; set; }
- public TypeQualifiers Qualifiers { get; set; }
+ public Type Type;
+ public TypeQualifiers Qualifiers;
public T Visit(ITypeVisitor visitor)
{
diff --git a/src/Generator/Generators/C/CppTypePrinter.cs b/src/Generator/Generators/C/CppTypePrinter.cs
index 8a84ab40..9e284fb8 100644
--- a/src/Generator/Generators/C/CppTypePrinter.cs
+++ b/src/Generator/Generators/C/CppTypePrinter.cs
@@ -433,6 +433,19 @@ namespace CppSharp.Generators.C
throw new NotImplementedException();
}
+ public override TypePrinterResult VisitQualifiedType(QualifiedType type)
+ {
+ if (type.Qualifiers.Mode == TypeQualifiersMode.Native)
+ {
+ PushContext(TypePrinterContextKind.Native);
+ var result = base.VisitQualifiedType(type);
+ PopContext();
+ return result;
+ }
+
+ return base.VisitQualifiedType(type);
+ }
+
public TypePrinterResult GetDeclName(Declaration declaration,
TypePrintScopeKind scope)
{