-
Notifications
You must be signed in to change notification settings - Fork 10
/
LandingPad.cs
63 lines (53 loc) · 2.24 KB
/
LandingPad.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -----------------------------------------------------------------------
// <copyright file="LandingPad.cs" company="Ubiquity.NET Contributors">
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.Collections.Generic;
using Ubiquity.ArgValidators;
using Ubiquity.NET.Llvm.Interop;
using Ubiquity.NET.Llvm.Values;
using static Ubiquity.NET.Llvm.Interop.NativeMethods;
namespace Ubiquity.NET.Llvm.Instructions
{
/// <summary>Marks a <see cref="BasicBlock"/> as a catch handler</summary>
/// <remarks>
/// Like the <see cref="CatchPad"/>, instruction this must be the first non-phi instruction
/// in the block.
/// </remarks>
/// <seealso href="xref:llvm_langref#i-landingpad">LLVM landing Instruction</seealso>
/// <seealso href="xref:llvm_exception_handling#exception-handling-in-llvm">Exception Handling in LLVM</seealso>
public class LandingPad
: Instruction
, IOperandContainer<Constant>
{
/// <summary>Gets the list of clauses for this pad</summary>
public IList<Constant> Clauses { get; }
/// <summary>Gets or sets a value indicating whether this <see cref="LandingPad"/> is a cleanup pad</summary>
public bool IsCleanup
{
get => LLVMIsCleanup( ValueHandle );
set => LLVMSetCleanup( ValueHandle, value );
}
/// <inheritdoc/>
long IOperandContainer<Constant>.Count => Operands.Count;
/// <inheritdoc/>
Constant? IOperandContainer<Constant>.this[ int index ]
{
get => GetOperand<Constant>( index );
set => Operands[ index ] = value.ValidateNotNull( nameof( value ) )!;
}
/// <inheritdoc/>
/// <remarks>The <paramref name="item"/> parameter must not be <see langword="null"/></remarks>
void IOperandContainer<Constant>.Add( Constant? item )
{
item.ValidateNotNull( nameof( item ) );
LLVMAddClause( ValueHandle, item!.ValueHandle );
}
internal LandingPad( LLVMValueRef valueRef )
: base( valueRef )
{
Clauses = new OperandList<Constant>( this );
}
}
}