+// Returns Attribute::None on unrecognized codes.
+static Attribute::AttrKind GetAttrFromCode(uint64_t Code) {
+ switch (Code) {
+ default:
+ return Attribute::None;
+ case bitc::ATTR_KIND_ALIGNMENT:
+ return Attribute::Alignment;
+ case bitc::ATTR_KIND_ALWAYS_INLINE:
+ return Attribute::AlwaysInline;
+ case bitc::ATTR_KIND_BUILTIN:
+ return Attribute::Builtin;
+ case bitc::ATTR_KIND_BY_VAL:
+ return Attribute::ByVal;
+ case bitc::ATTR_KIND_IN_ALLOCA:
+ return Attribute::InAlloca;
+ case bitc::ATTR_KIND_COLD:
+ return Attribute::Cold;
+ case bitc::ATTR_KIND_INLINE_HINT:
+ return Attribute::InlineHint;
+ case bitc::ATTR_KIND_IN_REG:
+ return Attribute::InReg;
+ case bitc::ATTR_KIND_JUMP_TABLE:
+ return Attribute::JumpTable;
+ case bitc::ATTR_KIND_MIN_SIZE:
+ return Attribute::MinSize;
+ case bitc::ATTR_KIND_NAKED:
+ return Attribute::Naked;
+ case bitc::ATTR_KIND_NEST:
+ return Attribute::Nest;
+ case bitc::ATTR_KIND_NO_ALIAS:
+ return Attribute::NoAlias;
+ case bitc::ATTR_KIND_NO_BUILTIN:
+ return Attribute::NoBuiltin;
+ case bitc::ATTR_KIND_NO_CAPTURE:
+ return Attribute::NoCapture;
+ case bitc::ATTR_KIND_NO_DUPLICATE:
+ return Attribute::NoDuplicate;
+ case bitc::ATTR_KIND_NO_IMPLICIT_FLOAT:
+ return Attribute::NoImplicitFloat;
+ case bitc::ATTR_KIND_NO_INLINE:
+ return Attribute::NoInline;
+ case bitc::ATTR_KIND_NON_LAZY_BIND:
+ return Attribute::NonLazyBind;
+ case bitc::ATTR_KIND_NON_NULL:
+ return Attribute::NonNull;
+ case bitc::ATTR_KIND_DEREFERENCEABLE:
+ return Attribute::Dereferenceable;
+ case bitc::ATTR_KIND_NO_RED_ZONE:
+ return Attribute::NoRedZone;
+ case bitc::ATTR_KIND_NO_RETURN:
+ return Attribute::NoReturn;
+ case bitc::ATTR_KIND_NO_UNWIND:
+ return Attribute::NoUnwind;
+ case bitc::ATTR_KIND_OPTIMIZE_FOR_SIZE:
+ return Attribute::OptimizeForSize;
+ case bitc::ATTR_KIND_OPTIMIZE_NONE:
+ return Attribute::OptimizeNone;
+ case bitc::ATTR_KIND_READ_NONE:
+ return Attribute::ReadNone;
+ case bitc::ATTR_KIND_READ_ONLY:
+ return Attribute::ReadOnly;
+ case bitc::ATTR_KIND_RETURNED:
+ return Attribute::Returned;
+ case bitc::ATTR_KIND_RETURNS_TWICE:
+ return Attribute::ReturnsTwice;
+ case bitc::ATTR_KIND_S_EXT:
+ return Attribute::SExt;
+ case bitc::ATTR_KIND_STACK_ALIGNMENT:
+ return Attribute::StackAlignment;
+ case bitc::ATTR_KIND_STACK_PROTECT:
+ return Attribute::StackProtect;
+ case bitc::ATTR_KIND_STACK_PROTECT_REQ:
+ return Attribute::StackProtectReq;
+ case bitc::ATTR_KIND_STACK_PROTECT_STRONG:
+ return Attribute::StackProtectStrong;
+ case bitc::ATTR_KIND_STRUCT_RET:
+ return Attribute::StructRet;
+ case bitc::ATTR_KIND_SANITIZE_ADDRESS:
+ return Attribute::SanitizeAddress;
+ case bitc::ATTR_KIND_SANITIZE_THREAD:
+ return Attribute::SanitizeThread;
+ case bitc::ATTR_KIND_SANITIZE_MEMORY:
+ return Attribute::SanitizeMemory;
+ case bitc::ATTR_KIND_UW_TABLE:
+ return Attribute::UWTable;
+ case bitc::ATTR_KIND_Z_EXT:
+ return Attribute::ZExt;
+ }
+}