diff --git a/src/Bridge/Type.cs b/src/Bridge/Type.cs index c4081c84..357b0f7c 100644 --- a/src/Bridge/Type.cs +++ b/src/Bridge/Type.cs @@ -13,14 +13,37 @@ namespace Cxxi { } - public bool IsPrimitiveType(PrimitiveType primitive) + public bool IsPrimitiveType(out PrimitiveType primitive, + bool walkTypedefs = false) { var builtin = this as BuiltinType; if (builtin != null) - return builtin.Type == primitive; + { + primitive = builtin.Type; + return true; + } + + if (walkTypedefs) + { + var typedef = this as TypedefType; + if (typedef != null) + return typedef.Declaration.Type.IsPrimitiveType(out primitive, true); + } + + primitive = PrimitiveType.Null; return false; } + public bool IsPrimitiveType(PrimitiveType primitive, + bool walkTypedefs = false) + { + PrimitiveType type; + if (!IsPrimitiveType(out type, walkTypedefs)) + return false; + + return primitive == type; + } + public bool IsEnumType() { var tag = this as TagType;