Browse Source

Added support for values in more literal expressions.

pull/1182/head
Joao Matos 6 years ago committed by João Matos
parent
commit
5559ef47c7
  1. 2
      src/AST/Expr.cs
  2. 20
      src/CppParser/Bindings/CLI/Expr.cpp
  3. 12
      src/CppParser/Bindings/CLI/Expr.h
  4. 36
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  5. 36
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs
  6. 36
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  7. 36
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  8. 36
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs
  9. 36
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs
  10. 48
      src/CppParser/Bootstrap/Bootstrap.cs
  11. 2
      src/CppParser/Expr.cpp
  12. 2
      src/CppParser/Expr.h
  13. 2
      src/CppParser/ParseExpr.cpp
  14. 2
      src/Parser/ASTConverter.Expr.cs

2
src/AST/Expr.cs

@ -434,6 +434,7 @@ namespace CppSharp.AST @@ -434,6 +434,7 @@ namespace CppSharp.AST
}
public SourceLocation Location;
public ulong Value;
}
public partial class FixedPointLiteral : Expr
@ -443,6 +444,7 @@ namespace CppSharp.AST @@ -443,6 +444,7 @@ namespace CppSharp.AST
}
public SourceLocation Location;
public ulong Value;
}
public partial class CharacterLiteral : Expr

20
src/CppParser/Bindings/CLI/Expr.cpp

@ -636,6 +636,16 @@ void CppSharp::Parser::AST::IntegerLiteral::Location::set(CppSharp::Parser::Sour @@ -636,6 +636,16 @@ void CppSharp::Parser::AST::IntegerLiteral::Location::set(CppSharp::Parser::Sour
((::CppSharp::CppParser::AST::IntegerLiteral*)NativePtr)->location = _marshal0;
}
unsigned long long CppSharp::Parser::AST::IntegerLiteral::Value::get()
{
return ((::CppSharp::CppParser::AST::IntegerLiteral*)NativePtr)->value;
}
void CppSharp::Parser::AST::IntegerLiteral::Value::set(unsigned long long value)
{
((::CppSharp::CppParser::AST::IntegerLiteral*)NativePtr)->value = value;
}
CppSharp::Parser::AST::FixedPointLiteral::FixedPointLiteral(::CppSharp::CppParser::AST::FixedPointLiteral* native)
: CppSharp::Parser::AST::Expr((::CppSharp::CppParser::AST::Expr*)native)
{
@ -679,6 +689,16 @@ void CppSharp::Parser::AST::FixedPointLiteral::Location::set(CppSharp::Parser::S @@ -679,6 +689,16 @@ void CppSharp::Parser::AST::FixedPointLiteral::Location::set(CppSharp::Parser::S
((::CppSharp::CppParser::AST::FixedPointLiteral*)NativePtr)->location = _marshal0;
}
unsigned long long CppSharp::Parser::AST::FixedPointLiteral::Value::get()
{
return ((::CppSharp::CppParser::AST::FixedPointLiteral*)NativePtr)->value;
}
void CppSharp::Parser::AST::FixedPointLiteral::Value::set(unsigned long long value)
{
((::CppSharp::CppParser::AST::FixedPointLiteral*)NativePtr)->value = value;
}
CppSharp::Parser::AST::CharacterLiteral::CharacterLiteral(::CppSharp::CppParser::AST::CharacterLiteral* native)
: CppSharp::Parser::AST::Expr((::CppSharp::CppParser::AST::Expr*)native)
{

12
src/CppParser/Bindings/CLI/Expr.h

@ -741,6 +741,12 @@ namespace CppSharp @@ -741,6 +741,12 @@ namespace CppSharp
CppSharp::Parser::SourceLocation get();
void set(CppSharp::Parser::SourceLocation);
}
property unsigned long long Value
{
unsigned long long get();
void set(unsigned long long);
}
};
public ref class FixedPointLiteral : CppSharp::Parser::AST::Expr
@ -760,6 +766,12 @@ namespace CppSharp @@ -760,6 +766,12 @@ namespace CppSharp
CppSharp::Parser::SourceLocation get();
void set(CppSharp::Parser::SourceLocation);
}
property unsigned long long Value
{
unsigned long long get();
void set(unsigned long long);
}
};
public ref class CharacterLiteral : CppSharp::Parser::AST::Expr

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

@ -24832,7 +24832,7 @@ namespace CppSharp @@ -24832,7 +24832,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 44)]
[StructLayout(LayoutKind.Explicit, Size = 52)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24880,6 +24880,9 @@ namespace CppSharp @@ -24880,6 +24880,9 @@ namespace CppSharp
[FieldOffset(40)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(44)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST14IntegerLiteralC2Ev")]
@ -24954,11 +24957,24 @@ namespace CppSharp @@ -24954,11 +24957,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 44)]
[StructLayout(LayoutKind.Explicit, Size = 52)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25006,6 +25022,9 @@ namespace CppSharp @@ -25006,6 +25022,9 @@ namespace CppSharp
[FieldOffset(40)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(44)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST17FixedPointLiteralC2Ev")]
@ -25080,6 +25099,19 @@ namespace CppSharp @@ -25080,6 +25099,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

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

@ -24832,7 +24832,7 @@ namespace CppSharp @@ -24832,7 +24832,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 44)]
[StructLayout(LayoutKind.Explicit, Size = 56)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24880,6 +24880,9 @@ namespace CppSharp @@ -24880,6 +24880,9 @@ namespace CppSharp
[FieldOffset(40)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(48)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??0IntegerLiteral@AST@CppParser@CppSharp@@QAE@XZ")]
@ -24954,11 +24957,24 @@ namespace CppSharp @@ -24954,11 +24957,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 44)]
[StructLayout(LayoutKind.Explicit, Size = 56)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25006,6 +25022,9 @@ namespace CppSharp @@ -25006,6 +25022,9 @@ namespace CppSharp
[FieldOffset(40)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(48)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??0FixedPointLiteral@AST@CppParser@CppSharp@@QAE@XZ")]
@ -25080,6 +25099,19 @@ namespace CppSharp @@ -25080,6 +25099,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

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

@ -24831,7 +24831,7 @@ namespace CppSharp @@ -24831,7 +24831,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24879,6 +24879,9 @@ namespace CppSharp @@ -24879,6 +24879,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST14IntegerLiteralC2Ev")]
@ -24953,11 +24956,24 @@ namespace CppSharp @@ -24953,11 +24956,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25005,6 +25021,9 @@ namespace CppSharp @@ -25005,6 +25021,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST17FixedPointLiteralC2Ev")]
@ -25079,6 +25098,19 @@ namespace CppSharp @@ -25079,6 +25098,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

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

@ -24831,7 +24831,7 @@ namespace CppSharp @@ -24831,7 +24831,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24879,6 +24879,9 @@ namespace CppSharp @@ -24879,6 +24879,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST14IntegerLiteralC2Ev")]
@ -24953,11 +24956,24 @@ namespace CppSharp @@ -24953,11 +24956,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25005,6 +25021,9 @@ namespace CppSharp @@ -25005,6 +25021,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST17FixedPointLiteralC2Ev")]
@ -25079,6 +25098,19 @@ namespace CppSharp @@ -25079,6 +25098,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

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

@ -24831,7 +24831,7 @@ namespace CppSharp @@ -24831,7 +24831,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24879,6 +24879,9 @@ namespace CppSharp @@ -24879,6 +24879,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST14IntegerLiteralC2Ev")]
@ -24953,11 +24956,24 @@ namespace CppSharp @@ -24953,11 +24956,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25005,6 +25021,9 @@ namespace CppSharp @@ -25005,6 +25021,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser3AST17FixedPointLiteralC2Ev")]
@ -25079,6 +25098,19 @@ namespace CppSharp @@ -25079,6 +25098,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

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

@ -24832,7 +24832,7 @@ namespace CppSharp @@ -24832,7 +24832,7 @@ namespace CppSharp
public unsafe partial class IntegerLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -24880,6 +24880,9 @@ namespace CppSharp @@ -24880,6 +24880,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0IntegerLiteral@AST@CppParser@CppSharp@@QEAA@XZ")]
@ -24954,11 +24957,24 @@ namespace CppSharp @@ -24954,11 +24957,24 @@ namespace CppSharp
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.IntegerLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class FixedPointLiteral : global::CppSharp.Parser.AST.Expr, IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 56)]
[StructLayout(LayoutKind.Explicit, Size = 64)]
public new partial struct __Internal
{
[FieldOffset(0)]
@ -25006,6 +25022,9 @@ namespace CppSharp @@ -25006,6 +25022,9 @@ namespace CppSharp
[FieldOffset(48)]
internal global::CppSharp.Parser.SourceLocation.__Internal location;
[FieldOffset(56)]
internal ulong value;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0FixedPointLiteral@AST@CppParser@CppSharp@@QEAA@XZ")]
@ -25080,6 +25099,19 @@ namespace CppSharp @@ -25080,6 +25099,19 @@ namespace CppSharp
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->location = value.__Instance;
}
}
public ulong Value
{
get
{
return ((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*) __Instance)->value;
}
set
{
((global::CppSharp.Parser.AST.FixedPointLiteral.__Internal*)__Instance)->value = value;
}
}
}
public unsafe partial class CharacterLiteral : global::CppSharp.Parser.AST.Expr, IDisposable

48
src/CppParser/Bootstrap/Bootstrap.cs

@ -294,6 +294,40 @@ namespace CppSharp @@ -294,6 +294,40 @@ namespace CppSharp
if (@base.Class.Name.Contains("TrailingObjects"))
@base.ExplicitlyIgnore();
if (@base.Class.Name == "APIntStorage")
{
@base.ExplicitlyIgnore();
var property = new Property
{
Access = AccessSpecifier.Public,
Name = "value",
Namespace = @class,
QualifiedType = new QualifiedType(
new BuiltinType(PrimitiveType.ULongLong))
};
if (!@class.Properties.Exists(p => p.Name == property.Name))
@class.Properties.Add(property);
}
if (@base.Class.Name == "APFloatStorage")
{
@base.ExplicitlyIgnore();
var property = new Property
{
Access = AccessSpecifier.Public,
Name = "value",
Namespace = @class,
QualifiedType = new QualifiedType(
new BuiltinType(PrimitiveType.LongDouble))
};
if (!@class.Properties.Exists(p => p.Name == property.Name))
@class.Properties.Add(property);
}
}
//
@ -1146,7 +1180,7 @@ namespace CppSharp @@ -1146,7 +1180,7 @@ namespace CppSharp
{
var typeName = GetDeclTypeName(property);
var fieldName = GetDeclName(property);
var methodName = property.GetMethod.Name;
var methodName = property.GetMethod?.Name;
var validMethod = $"is{FirstLetterToUpperCase(property.Name)}";
var @class = property.Namespace as Class;
@ -1179,7 +1213,12 @@ namespace CppSharp @@ -1179,7 +1213,12 @@ namespace CppSharp
WriteLine($"_S->{fieldName} = WalkTemplateArgument(S->{methodName}());");
else if (typeName.Contains("QualifiedType"))
WriteLine($"_S->{fieldName} = GetQualifiedType(S->{methodName}());");
else
else if (fieldName == "value" && @class.Bases.Exists(b => b.Class.Name.Contains("AP"))) {
// Use llvm::APInt or llvm::APFloat conversion methods
methodName = property.Type.IsPrimitiveType(PrimitiveType.ULongLong) ?
"getLimitedValue" : "convertToDouble";
WriteLine($"_S->{fieldName} = S->getValue().{methodName}();");
} else
WriteLine($"_S->{fieldName} = S->{methodName}();");
if (validMethodExists)
@ -1344,12 +1383,7 @@ namespace CppSharp @@ -1344,12 +1383,7 @@ namespace CppSharp
if (property.Access != AccessSpecifier.Public)
return true;
if (property.GetMethod == null)
return true;
var @class = property.Namespace as Class;
if (property.GetMethod.Namespace != @class)
return true;
if (!skipBaseCheck)
{

2
src/CppParser/Expr.cpp

@ -91,12 +91,14 @@ DeclRefExpr::DeclRefExpr() @@ -91,12 +91,14 @@ DeclRefExpr::DeclRefExpr()
IntegerLiteral::IntegerLiteral()
: Expr(StmtClass::IntegerLiteral)
, location(SourceLocation())
, value(0)
{
}
FixedPointLiteral::FixedPointLiteral()
: Expr(StmtClass::FixedPointLiteral)
, location(SourceLocation())
, value(0)
{
}

2
src/CppParser/Expr.h

@ -376,6 +376,7 @@ class CS_API IntegerLiteral : public Expr @@ -376,6 +376,7 @@ class CS_API IntegerLiteral : public Expr
public:
IntegerLiteral();
SourceLocation location;
unsigned long long value;
};
class CS_API FixedPointLiteral : public Expr
@ -383,6 +384,7 @@ class CS_API FixedPointLiteral : public Expr @@ -383,6 +384,7 @@ class CS_API FixedPointLiteral : public Expr
public:
FixedPointLiteral();
SourceLocation location;
unsigned long long value;
};
class CS_API CharacterLiteral : public Expr

2
src/CppParser/ParseExpr.cpp

@ -97,6 +97,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) @@ -97,6 +97,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->isXValue = S->isXValue();
_S->isGLValue = S->isGLValue();
_S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject();
_S->value = S->getValue().getLimitedValue();
_Expr = _S;
break;
}
@ -114,6 +115,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr) @@ -114,6 +115,7 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
_S->isXValue = S->isXValue();
_S->isGLValue = S->isGLValue();
_S->isOrdinaryOrBitFieldObject = S->isOrdinaryOrBitFieldObject();
_S->value = S->getValue().getLimitedValue();
_Expr = _S;
break;
}

2
src/Parser/ASTConverter.Expr.cs

@ -690,6 +690,7 @@ namespace CppSharp @@ -690,6 +690,7 @@ namespace CppSharp
_expr.IsGLValue = expr.IsGLValue;
_expr.IsOrdinaryOrBitFieldObject = expr.IsOrdinaryOrBitFieldObject;
_expr.Location = VisitSourceLocation(expr.Location);
_expr.Value = expr.Value;
return _expr;
}
@ -710,6 +711,7 @@ namespace CppSharp @@ -710,6 +711,7 @@ namespace CppSharp
_expr.IsGLValue = expr.IsGLValue;
_expr.IsOrdinaryOrBitFieldObject = expr.IsOrdinaryOrBitFieldObject;
_expr.Location = VisitSourceLocation(expr.Location);
_expr.Value = expr.Value;
return _expr;
}

Loading…
Cancel
Save