@@ -8,17 +8,23 @@ public unsafe partial struct LLVMAttributeRef(IntPtr handle) : IEquatable<LLVMAt
88{
99 public IntPtr Handle = handle ;
1010
11- public readonly uint EnumKind => IsEnumAttribute ? LLVM . GetEnumAttributeKind ( this ) : default ;
12-
13- public readonly ulong EnumValue => IsEnumAttribute ? LLVM . GetEnumAttributeValue ( this ) : default ;
14-
11+ /// <summary>
12+ /// <see href="https://github.com/llvm/llvm-project/blob/a64e6f49284a7ffd5401183d0e94a94a7de39cfb/llvm/include/llvm/IR/Attributes.h#L233"/>
13+ /// </summary>
14+ public readonly bool HasKindAsEnum => Handle != IntPtr . Zero && LLVM . IsStringAttribute ( this ) == 0 ;
15+
16+ /// <summary>
17+ /// <see href="https://github.com/llvm/llvm-project/blob/de7bac6426e7f544189dfba7ae658dcf3d7be5f6/llvm/lib/IR/Core.cpp#L231">This returns true for enum attributes and int attributes.</see>
18+ /// </summary>
1519 public readonly bool IsEnumAttribute => Handle != IntPtr . Zero && LLVM . IsEnumAttribute ( this ) != 0 ;
1620
1721 public readonly bool IsStringAttribute => Handle != IntPtr . Zero && LLVM . IsStringAttribute ( this ) != 0 ;
1822
1923 public readonly bool IsTypeAttribute => Handle != IntPtr . Zero && LLVM . IsTypeAttribute ( this ) != 0 ;
2024
21- public readonly string StringKind
25+ public readonly uint KindAsEnum => HasKindAsEnum ? LLVM . GetEnumAttributeKind ( this ) : default ;
26+
27+ public readonly string KindAsString
2228 {
2329 get
2430 {
@@ -38,7 +44,12 @@ public readonly string StringKind
3844 }
3945 }
4046
41- public readonly string StringValue
47+ /// <summary>
48+ /// <see href="https://github.com/llvm/llvm-project/blob/a64e6f49284a7ffd5401183d0e94a94a7de39cfb/llvm/lib/IR/Core.cpp#L175"/>
49+ /// </summary>
50+ public readonly ulong ValueAsInt => IsEnumAttribute ? LLVM . GetEnumAttributeValue ( this ) : default ;
51+
52+ public readonly string ValueAsString
4253 {
4354 get
4455 {
@@ -58,7 +69,7 @@ public readonly string StringValue
5869 }
5970 }
6071
61- public readonly LLVMTypeRef TypeValue => IsTypeAttribute ? LLVM . GetTypeAttributeValue ( this ) : default ;
72+ public readonly LLVMTypeRef ValueAsType => IsTypeAttribute ? LLVM . GetTypeAttributeValue ( this ) : default ;
6273
6374 public static implicit operator LLVMAttributeRef ( LLVMOpaqueAttributeRef * value ) => new LLVMAttributeRef ( ( IntPtr ) value ) ;
6475
0 commit comments