Skip to content

Commit

Permalink
Fix bug enum values in another header file (#31)
Browse files Browse the repository at this point in the history
* Rename

* Fix bug
  • Loading branch information
lithiumtoast authored May 12, 2024
1 parent d520a26 commit 50253c7
Show file tree
Hide file tree
Showing 24 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/cs/c2ffi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c2ffi.Tests.EndToEnd.Extrac
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c2ffi.Data", "production\c2ffi.Data\c2ffi.Data.csproj", "{14BAF06A-F498-4B99-AD01-FA300EFFAB42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c2ffi.Tests.Library", "tests\c2ffi.Tests.Library\c2ffi.Tests.Library.csproj", "{D8933EFB-2F00-4356-8F69-4438A9711DA3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c2ffi.Tests.Common", "tests\c2ffi.Tests.Common\c2ffi.Tests.Common.csproj", "{D8933EFB-2F00-4356-8F69-4438A9711DA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c2ffi.Tests.EndToEnd.Merge", "tests\c2ffi.Tests.EndToEnd.Merge\c2ffi.Tests.EndToEnd.Merge.csproj", "{CEC639D4-F1FD-40BD-81B7-B20B2DE18EA1}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public static bool IsSignedPrimitive(this CXType clangType)
}

public static ImmutableArray<CXCursor> GetDescendents(
this CXCursor cursor, VisitChildPredicate? predicate = null, bool mustBeFromSameFile = true)
this CXCursor cursor, VisitChildPredicate? predicate = null)
{
var predicate2 = predicate ?? EmptyVisitChildPredicate;
var visitData = new VisitChildInstance(predicate2, mustBeFromSameFile);
var visitData = new VisitChildInstance(predicate2);
var visitsCount = Interlocked.Increment(ref _visitChildCount);
if (visitsCount > _visitChildInstances.Length)
{
Expand Down Expand Up @@ -155,17 +155,6 @@ private static CXChildVisitResult VisitChild(CXCursor child, CXCursor parent, CX
}

var data = _visitChildInstances[index - 1];

if (data.MustBeFromSameFile)
{
var location = clang_getCursorLocation(child);
var isFromMainFile = clang_Location_isFromMainFile(location) > 0;
if (!isFromMainFile)
{
return CXChildVisitResult.CXChildVisit_Continue;
}
}

var result = data.Predicate(child, parent);
if (!result)
{
Expand Down Expand Up @@ -195,13 +184,11 @@ private readonly struct VisitChildInstance
{
public readonly VisitChildPredicate Predicate;
public readonly ImmutableArray<CXCursor>.Builder CursorBuilder;
public readonly bool MustBeFromSameFile;

public VisitChildInstance(VisitChildPredicate predicate, bool mustBeFromSameFile)
public VisitChildInstance(VisitChildPredicate predicate)
{
Predicate = predicate;
CursorBuilder = ImmutableArray.CreateBuilder<CXCursor>();
MustBeFromSameFile = mustBeFromSameFile;
}
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- Project references -->
<ItemGroup>
<ProjectReference Include="..\c2ffi.Tests.Library\c2ffi.Tests.Library.csproj" />
<ProjectReference Include="..\c2ffi.Tests.Common\c2ffi.Tests.Common.csproj" />
</ItemGroup>

<!-- NuGet package references -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- Project references -->
<ItemGroup>
<ProjectReference Include="..\c2ffi.Tests.Library\c2ffi.Tests.Library.csproj" />
<ProjectReference Include="..\c2ffi.Tests.Common\c2ffi.Tests.Common.csproj" />
</ItemGroup>

<!-- NuGet package references -->
Expand Down

0 comments on commit 50253c7

Please sign in to comment.