Skip to content

Commit 378c9b3

Browse files
committed
Added support for parsing function bodies (and option SkipFunctionBodies).
1 parent 06ddf85 commit 378c9b3

File tree

13 files changed

+127
-1
lines changed

13 files changed

+127
-1
lines changed

src/CppParser/AST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ Friend::Friend() : CppSharp::CppParser::AST::Declaration(DeclarationKind::Friend
565565

566566
Friend::~Friend() {}
567567

568-
569568
StatementObsolete::StatementObsolete(const std::string& str, StatementClassObsolete stmtClass, Declaration* decl) : string(str), _class(stmtClass), decl(decl) {}
570569

571570
ExpressionObsolete::ExpressionObsolete(const std::string& str, StatementClassObsolete stmtClass, Declaration* decl)
@@ -643,6 +642,7 @@ Function::Function()
643642
, callingConvention(CallingConvention::Default)
644643
, specializationInfo(0)
645644
, instantiatedFrom(0)
645+
, bodyStmt(0)
646646
{
647647
}
648648

src/CppParser/Bindings/CLI/CppParser.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,16 @@ void CppSharp::Parser::CppParserOptions::SkipLayoutInfo::set(bool value)
511511
((::CppSharp::CppParser::CppParserOptions*)NativePtr)->skipLayoutInfo = value;
512512
}
513513

514+
bool CppSharp::Parser::CppParserOptions::SkipFunctionBodies::get()
515+
{
516+
return ((::CppSharp::CppParser::CppParserOptions*)NativePtr)->skipFunctionBodies;
517+
}
518+
519+
void CppSharp::Parser::CppParserOptions::SkipFunctionBodies::set(bool value)
520+
{
521+
((::CppSharp::CppParser::CppParserOptions*)NativePtr)->skipFunctionBodies = value;
522+
}
523+
514524
unsigned int CppSharp::Parser::CppParserOptions::ArgumentsCount::get()
515525
{
516526
auto __ret = ((::CppSharp::CppParser::CppParserOptions*)NativePtr)->getArgumentsCount();

src/CppParser/Bindings/CLI/CppParser.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ namespace CppSharp
205205
void set(bool);
206206
}
207207

208+
property bool SkipFunctionBodies
209+
{
210+
bool get();
211+
void set(bool);
212+
}
213+
208214
property unsigned int ArgumentsCount
209215
{
210216
unsigned int get();

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44368,6 +44368,9 @@ public partial struct __Internal
4436844368
[FieldOffset(150)]
4436944369
internal byte skipLayoutInfo;
4437044370

44371+
[FieldOffset(151)]
44372+
internal byte skipFunctionBodies;
44373+
4437144374
[SuppressUnmanagedCodeSecurity]
4437244375
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
4437344376
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2Ev")]
@@ -44931,6 +44934,19 @@ public bool SkipLayoutInfo
4493144934
}
4493244935
}
4493344936

44937+
public bool SkipFunctionBodies
44938+
{
44939+
get
44940+
{
44941+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44942+
}
44943+
44944+
set
44945+
{
44946+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44947+
}
44948+
}
44949+
4493444950
public uint ArgumentsCount
4493544951
{
4493644952
get

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44368,6 +44368,9 @@ public partial struct __Internal
4436844368
[FieldOffset(186)]
4436944369
internal byte skipLayoutInfo;
4437044370

44371+
[FieldOffset(187)]
44372+
internal byte skipFunctionBodies;
44373+
4437144374
[SuppressUnmanagedCodeSecurity]
4437244375
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
4437344376
EntryPoint="??0CppParserOptions@CppParser@CppSharp@@QAE@XZ")]
@@ -44931,6 +44934,19 @@ public bool SkipLayoutInfo
4493144934
}
4493244935
}
4493344936

44937+
public bool SkipFunctionBodies
44938+
{
44939+
get
44940+
{
44941+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44942+
}
44943+
44944+
set
44945+
{
44946+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44947+
}
44948+
}
44949+
4493444950
public uint ArgumentsCount
4493544951
{
4493644952
get

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44367,6 +44367,9 @@ public partial struct __Internal
4436744367
[FieldOffset(290)]
4436844368
internal byte skipLayoutInfo;
4436944369

44370+
[FieldOffset(291)]
44371+
internal byte skipFunctionBodies;
44372+
4437044373
[SuppressUnmanagedCodeSecurity]
4437144374
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
4437244375
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2Ev")]
@@ -44930,6 +44933,19 @@ public bool SkipLayoutInfo
4493044933
}
4493144934
}
4493244935

44936+
public bool SkipFunctionBodies
44937+
{
44938+
get
44939+
{
44940+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44941+
}
44942+
44943+
set
44944+
{
44945+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44946+
}
44947+
}
44948+
4493344949
public uint ArgumentsCount
4493444950
{
4493544951
get

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44367,6 +44367,9 @@ public partial struct __Internal
4436744367
[FieldOffset(314)]
4436844368
internal byte skipLayoutInfo;
4436944369

44370+
[FieldOffset(315)]
44371+
internal byte skipFunctionBodies;
44372+
4437044373
[SuppressUnmanagedCodeSecurity]
4437144374
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
4437244375
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2Ev")]
@@ -44930,6 +44933,19 @@ public bool SkipLayoutInfo
4493044933
}
4493144934
}
4493244935

44936+
public bool SkipFunctionBodies
44937+
{
44938+
get
44939+
{
44940+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44941+
}
44942+
44943+
set
44944+
{
44945+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44946+
}
44947+
}
44948+
4493344949
public uint ArgumentsCount
4493444950
{
4493544951
get

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44367,6 +44367,9 @@ public partial struct __Internal
4436744367
[FieldOffset(242)]
4436844368
internal byte skipLayoutInfo;
4436944369

44370+
[FieldOffset(243)]
44371+
internal byte skipFunctionBodies;
44372+
4437044373
[SuppressUnmanagedCodeSecurity]
4437144374
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
4437244375
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2Ev")]
@@ -44930,6 +44933,19 @@ public bool SkipLayoutInfo
4493044933
}
4493144934
}
4493244935

44936+
public bool SkipFunctionBodies
44937+
{
44938+
get
44939+
{
44940+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44941+
}
44942+
44943+
set
44944+
{
44945+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44946+
}
44947+
}
44948+
4493344949
public uint ArgumentsCount
4493444950
{
4493544951
get

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44368,6 +44368,9 @@ public partial struct __Internal
4436844368
[FieldOffset(314)]
4436944369
internal byte skipLayoutInfo;
4437044370

44371+
[FieldOffset(315)]
44372+
internal byte skipFunctionBodies;
44373+
4437144374
[SuppressUnmanagedCodeSecurity]
4437244375
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
4437344376
EntryPoint="??0CppParserOptions@CppParser@CppSharp@@QEAA@XZ")]
@@ -44931,6 +44934,19 @@ public bool SkipLayoutInfo
4493144934
}
4493244935
}
4493344936

44937+
public bool SkipFunctionBodies
44938+
{
44939+
get
44940+
{
44941+
return ((global::CppSharp.Parser.CppParserOptions.__Internal*) __Instance)->skipFunctionBodies != 0;
44942+
}
44943+
44944+
set
44945+
{
44946+
((global::CppSharp.Parser.CppParserOptions.__Internal*)__Instance)->skipFunctionBodies = (byte) (value ? 1 : 0);
44947+
}
44948+
}
44949+
4493444950
public uint ArgumentsCount
4493544951
{
4493644952
get

src/CppParser/CppParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CppParserOptions::CppParserOptions()
2121
, unityBuild(false)
2222
, skipPrivateDeclarations(true)
2323
, skipLayoutInfo(false)
24+
, skipFunctionBodies(true)
2425
{
2526
}
2627

0 commit comments

Comments
 (0)