File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -604,6 +604,17 @@ unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A);
604604 */
605605uint64_t LLVMGetEnumAttributeValue (LLVMAttributeRef A );
606606
607+ /**
608+ * Create a type attribute
609+ */
610+ LLVMAttributeRef LLVMCreateTypeAttribute (LLVMContextRef C , unsigned KindID ,
611+ LLVMTypeRef type_ref );
612+
613+ /**
614+ * Get the type attribute's value.
615+ */
616+ LLVMTypeRef LLVMGetTypeAttributeValue (LLVMAttributeRef A );
617+
607618/**
608619 * Create a string attribute.
609620 */
@@ -626,6 +637,7 @@ const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
626637 */
627638LLVMBool LLVMIsEnumAttribute (LLVMAttributeRef A );
628639LLVMBool LLVMIsStringAttribute (LLVMAttributeRef A );
640+ LLVMBool LLVMIsTypeAttribute (LLVMAttributeRef A );
629641
630642/**
631643 * Obtain a Type from a context by its registered name.
Original file line number Diff line number Diff line change @@ -164,6 +164,18 @@ uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A) {
164164 return Attr.getValueAsInt ();
165165}
166166
167+ LLVMAttributeRef LLVMCreateTypeAttribute (LLVMContextRef C, unsigned KindID,
168+ LLVMTypeRef type_ref) {
169+ auto &Ctx = *unwrap (C);
170+ auto AttrKind = (Attribute::AttrKind)KindID;
171+ return wrap (Attribute::get (Ctx, AttrKind, unwrap (type_ref)));
172+ }
173+
174+ LLVMTypeRef LLVMGetTypeAttributeValue (LLVMAttributeRef A) {
175+ auto Attr = unwrap (A);
176+ return wrap (Attr.getValueAsType ());
177+ }
178+
167179LLVMAttributeRef LLVMCreateStringAttribute (LLVMContextRef C,
168180 const char *K, unsigned KLength,
169181 const char *V, unsigned VLength) {
@@ -194,6 +206,10 @@ LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A) {
194206 return unwrap (A).isStringAttribute ();
195207}
196208
209+ LLVMBool LLVMIsTypeAttribute (LLVMAttributeRef A) {
210+ return unwrap (A).isTypeAttribute ();
211+ }
212+
197213char *LLVMGetDiagInfoDescription (LLVMDiagnosticInfoRef DI) {
198214 std::string MsgStorage;
199215 raw_string_ostream Stream (MsgStorage);
You can’t perform that action at this time.
0 commit comments