-
Notifications
You must be signed in to change notification settings - Fork 105
Add more properties to the wrapper structs #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5f87067
Add more properties to the wrapper structs
ds5678 21f258a
LLVMValueRef::Instructions
ds5678 8760482
Eliminate allocations for enumerable properties
ds5678 62a15db
Address review comments about attributes
ds5678 c7f8e40
Update sources/LLVMSharp.Interop/Extensions/LLVMAttributeRef.cs
ds5678 f82136f
Remove links to LLVM source
ds5678 1126740
Fix new()
ds5678 be0ab87
New lines
ds5678 659edb9
No records
ds5678 f712d72
More new()
ds5678 7d0f8da
Handle != IntPtr.Zero
ds5678 638b030
GetInstructions
ds5678 a847464
IsTemplateParameter property
ds5678 c14cf16
LLVMModuleRef::IsNewDbgInfoFormat
ds5678 f777907
LLVMValueRef::GetAllMetadataOtherThanDebugLoc
ds5678 1d1c935
Move it to be more alphabetical
ds5678 71ecbcc
Eliminate allocations of zero-length arrays
ds5678 c35e0b4
LLVMModuleRef::DebugMetadataVersion and LLVMValueRef::AsMetadata()
ds5678 e6a643f
LLVMValueRef::Context
ds5678 1a05529
LLVMMetadataRef::GetMDString
ds5678 940c3b4
LLVMMetadataRef::AsValue
ds5678 992d562
LLVMValueRef::HasMetadata for functions and global variables
ds5678 18fa00c
Undo previous commit
ds5678 bb4ee2e
Merge branch 'main' into more-properties
tannergooding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMBasicBlockInstructionsEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMBasicBlockInstructionsEnumerable(LLVMBasicBlockRef BasicBlock) : IEnumerable<LLVMValueRef> | ||
| { | ||
| public Enumerator GetEnumerator() => new(BasicBlock); | ||
|
ds5678 marked this conversation as resolved.
Outdated
|
||
| IEnumerator<LLVMValueRef> IEnumerable<LLVMValueRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMBasicBlockRef basicBlock) : IEnumerator<LLVMValueRef> | ||
| { | ||
| public LLVMValueRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = basicBlock.FirstInstruction; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextInstruction; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
|
ds5678 marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMModuleFunctionsEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMModuleFunctionsEnumerable(LLVMModuleRef Module) : IEnumerable<LLVMValueRef> | ||
|
ds5678 marked this conversation as resolved.
Outdated
|
||
| { | ||
| public Enumerator GetEnumerator() => new(Module); | ||
|
ds5678 marked this conversation as resolved.
Outdated
|
||
| IEnumerator<LLVMValueRef> IEnumerable<LLVMValueRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMModuleRef module) : IEnumerator<LLVMValueRef> | ||
| { | ||
| public LLVMValueRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = module.FirstFunction; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextFunction; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMModuleGlobalAliasesEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMModuleGlobalAliasesEnumerable(LLVMModuleRef Module) : IEnumerable<LLVMValueRef> | ||
| { | ||
| public Enumerator GetEnumerator() => new(Module); | ||
| IEnumerator<LLVMValueRef> IEnumerable<LLVMValueRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMModuleRef module) : IEnumerator<LLVMValueRef> | ||
| { | ||
| public LLVMValueRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = module.FirstGlobalAlias; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextGlobalAlias; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMModuleGlobalIFuncsEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMModuleGlobalIFuncsEnumerable(LLVMModuleRef Module) : IEnumerable<LLVMValueRef> | ||
| { | ||
| public Enumerator GetEnumerator() => new(Module); | ||
| IEnumerator<LLVMValueRef> IEnumerable<LLVMValueRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMModuleRef module) : IEnumerator<LLVMValueRef> | ||
| { | ||
| public LLVMValueRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = module.FirstGlobalIFunc; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextGlobalIFunc; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMModuleGlobalsEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMModuleGlobalsEnumerable(LLVMModuleRef Module) : IEnumerable<LLVMValueRef> | ||
| { | ||
| public Enumerator GetEnumerator() => new(Module); | ||
| IEnumerator<LLVMValueRef> IEnumerable<LLVMValueRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMModuleRef module) : IEnumerator<LLVMValueRef> | ||
| { | ||
| public LLVMValueRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = module.FirstGlobal; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextGlobal; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
sources/LLVMSharp.Interop/Extensions/LLVMModuleNamedMetadataEnumerable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace LLVMSharp.Interop; | ||
|
|
||
| public readonly record struct LLVMModuleNamedMetadataEnumerable(LLVMModuleRef Module) : IEnumerable<LLVMNamedMDNodeRef> | ||
| { | ||
| public Enumerator GetEnumerator() => new(Module); | ||
| IEnumerator<LLVMNamedMDNodeRef> IEnumerable<LLVMNamedMDNodeRef>.GetEnumerator() => GetEnumerator(); | ||
| IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
|
|
||
| public struct Enumerator(LLVMModuleRef module) : IEnumerator<LLVMNamedMDNodeRef> | ||
| { | ||
| public LLVMNamedMDNodeRef Current { get; private set; } | ||
| readonly object IEnumerator.Current => Current; | ||
| readonly void IDisposable.Dispose() { } | ||
| public bool MoveNext() | ||
| { | ||
| if (Current.Handle == 0) | ||
| { | ||
| Current = module.FirstNamedMetadata; | ||
| } | ||
| else | ||
| { | ||
| Current = Current.NextNamedMetadata; | ||
| } | ||
| return Current.Handle != 0; | ||
| } | ||
| public void Reset() => Current = default; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.