Browse Source

Added support for missing basic Clang built-in types.

pull/685/head
Joao Matos 9 years ago
parent
commit
b7689b2d60
  1. 7
      src/AST/CppTypePrinter.cs
  2. 7
      src/AST/Type.cs
  3. 12
      src/Core/Parser/ASTConverter.cs
  4. 6
      src/CppParser/AST.h
  5. 30
      src/CppParser/Bindings/CLI/AST.h
  6. 30
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  7. 30
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs
  8. 30
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  9. 30
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  10. 30
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs
  11. 30
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs
  12. 8
      src/CppParser/Parser.cpp
  13. 1
      src/Generator/Generators/CLI/CLITypePrinter.cs
  14. 1
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

7
src/AST/CppTypePrinter.cs

@ -103,7 +103,8 @@ namespace CppSharp.AST @@ -103,7 +103,8 @@ namespace CppSharp.AST
{
case PrimitiveType.Bool: return "bool";
case PrimitiveType.Void: return "void";
case PrimitiveType.Char16:
case PrimitiveType.Char16: return "char16_t";
case PrimitiveType.Char32: return "char32_t";
case PrimitiveType.WideChar: return "wchar_t";
case PrimitiveType.Char: return "char";
case PrimitiveType.UChar: return "unsigned char";
@ -115,9 +116,13 @@ namespace CppSharp.AST @@ -115,9 +116,13 @@ namespace CppSharp.AST
case PrimitiveType.ULong: return "unsigned long";
case PrimitiveType.LongLong: return "long long";
case PrimitiveType.ULongLong: return "unsigned long long";
case PrimitiveType.Int128: return "__int128_t";
case PrimitiveType.UInt128: return "__uint128_t";
case PrimitiveType.Half: return "__fp16";
case PrimitiveType.Float: return "float";
case PrimitiveType.Double: return "double";
case PrimitiveType.LongDouble: return "long double";
case PrimitiveType.Float128: return "__float128";
case PrimitiveType.IntPtr: return "void*";
case PrimitiveType.UIntPtr: return "uintptr_t";
case PrimitiveType.Null: return "std::nullptr_t";

7
src/AST/Type.cs

@ -1015,6 +1015,8 @@ namespace CppSharp.AST @@ -1015,6 +1015,8 @@ namespace CppSharp.AST
WideChar,
Char,
UChar,
Char16,
Char32,
Short,
UShort,
Int,
@ -1023,12 +1025,15 @@ namespace CppSharp.AST @@ -1023,12 +1025,15 @@ namespace CppSharp.AST
ULong,
LongLong,
ULongLong,
Int128,
UInt128,
Half,
Float,
Double,
LongDouble,
Float128,
IntPtr,
UIntPtr,
Char16
}
/// <summary>

12
src/Core/Parser/ASTConverter.cs

@ -673,6 +673,10 @@ namespace CppSharp @@ -673,6 +673,10 @@ namespace CppSharp
return AST.PrimitiveType.Char;
case PrimitiveType.UChar:
return AST.PrimitiveType.UChar;
case PrimitiveType.Char16:
return AST.PrimitiveType.Char16;
case PrimitiveType.Char32:
return AST.PrimitiveType.Char32;
case PrimitiveType.Short:
return AST.PrimitiveType.Short;
case PrimitiveType.UShort:
@ -689,12 +693,20 @@ namespace CppSharp @@ -689,12 +693,20 @@ namespace CppSharp
return AST.PrimitiveType.LongLong;
case PrimitiveType.ULongLong:
return AST.PrimitiveType.ULongLong;
case PrimitiveType.Int128:
return AST.PrimitiveType.Int128;
case PrimitiveType.UInt128:
return AST.PrimitiveType.UInt128;
case PrimitiveType.Half:
return AST.PrimitiveType.Half;
case PrimitiveType.Float:
return AST.PrimitiveType.Float;
case PrimitiveType.Double:
return AST.PrimitiveType.Double;
case PrimitiveType.LongDouble:
return AST.PrimitiveType.LongDouble;
case PrimitiveType.Float128:
return AST.PrimitiveType.Float128;
case PrimitiveType.IntPtr:
return AST.PrimitiveType.IntPtr;
default:

6
src/CppParser/AST.h

@ -258,6 +258,8 @@ enum class PrimitiveType @@ -258,6 +258,8 @@ enum class PrimitiveType
WideChar,
Char,
UChar,
Char16,
Char32,
Short,
UShort,
Int,
@ -266,9 +268,13 @@ enum class PrimitiveType @@ -266,9 +268,13 @@ enum class PrimitiveType
ULong,
LongLong,
ULongLong,
Int128,
UInt128,
Half,
Float,
Double,
LongDouble,
Float128,
IntPtr
};

30
src/CppParser/Bindings/CLI/AST.h

@ -330,18 +330,24 @@ namespace CppSharp @@ -330,18 +330,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
};
public enum struct MacroLocation

30
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

30
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

30
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

30
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

30
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

30
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs

@ -225,18 +225,24 @@ namespace CppSharp @@ -225,18 +225,24 @@ namespace CppSharp
WideChar = 3,
Char = 4,
UChar = 5,
Short = 6,
UShort = 7,
Int = 8,
UInt = 9,
Long = 10,
ULong = 11,
LongLong = 12,
ULongLong = 13,
Float = 14,
Double = 15,
LongDouble = 16,
IntPtr = 17
Char16 = 6,
Char32 = 7,
Short = 8,
UShort = 9,
Int = 10,
UInt = 11,
Long = 12,
ULong = 13,
LongLong = 14,
ULongLong = 15,
Int128 = 16,
UInt128 = 17,
Half = 18,
Float = 19,
Double = 20,
LongDouble = 21,
Float128 = 22,
IntPtr = 23
}
public enum MacroLocation

8
src/CppParser/Parser.cpp

@ -1876,6 +1876,9 @@ static PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin) @@ -1876,6 +1876,9 @@ static PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin)
case clang::BuiltinType::WChar_S:
case clang::BuiltinType::WChar_U: return PrimitiveType::WideChar;
case clang::BuiltinType::Char16: return PrimitiveType::Char16;
case clang::BuiltinType::Char32: return PrimitiveType::Char32;
case clang::BuiltinType::Short: return PrimitiveType::Short;
case clang::BuiltinType::UShort: return PrimitiveType::UShort;
@ -1888,9 +1891,14 @@ static PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin) @@ -1888,9 +1891,14 @@ static PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin)
case clang::BuiltinType::LongLong: return PrimitiveType::LongLong;
case clang::BuiltinType::ULongLong: return PrimitiveType::ULongLong;
case clang::BuiltinType::Int128: return PrimitiveType::Int128;
case clang::BuiltinType::UInt128: return PrimitiveType::UInt128;
case clang::BuiltinType::Half: return PrimitiveType::Half;
case clang::BuiltinType::Float: return PrimitiveType::Float;
case clang::BuiltinType::Double: return PrimitiveType::Double;
case clang::BuiltinType::LongDouble: return PrimitiveType::LongDouble;
case clang::BuiltinType::Float128: return PrimitiveType::Half;
case clang::BuiltinType::NullPtr: return PrimitiveType::Null;

1
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -206,6 +206,7 @@ namespace CppSharp.Generators.CLI @@ -206,6 +206,7 @@ namespace CppSharp.Generators.CLI
case PrimitiveType.Bool: return "bool";
case PrimitiveType.Void: return "void";
case PrimitiveType.Char16:
case PrimitiveType.Char32:
case PrimitiveType.WideChar: return "System::Char";
case PrimitiveType.Char: return Options.MarshalCharAsManagedChar ? "System::Char" : "char";
case PrimitiveType.UChar: return "unsigned char";

1
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -544,6 +544,7 @@ namespace CppSharp.Generators.CSharp @@ -544,6 +544,7 @@ namespace CppSharp.Generators.CSharp
"byte" : "bool";
case PrimitiveType.Void: return "void";
case PrimitiveType.Char16:
case PrimitiveType.Char32:
case PrimitiveType.WideChar: return "char";
case PrimitiveType.Char:
// returned structs must be blittable and char isn't

Loading…
Cancel
Save