1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[AsmWriter] Simplify type attribute printing (NFC)

Avoid enumerating all supported type attributes, instead fetch
their name from the attribute kind.
This commit is contained in:
Nikita Popov 2021-07-07 22:46:57 +02:00
parent 5c3c9d947d
commit 02090c5cdd

View File

@ -4416,20 +4416,7 @@ void AssemblyWriter::writeAttribute(const Attribute &Attr, bool InAttrGroup) {
return;
}
if (Attr.hasAttribute(Attribute::ByVal)) {
Out << "byval";
} else if (Attr.hasAttribute(Attribute::StructRet)) {
Out << "sret";
} else if (Attr.hasAttribute(Attribute::ByRef)) {
Out << "byref";
} else if (Attr.hasAttribute(Attribute::Preallocated)) {
Out << "preallocated";
} else if (Attr.hasAttribute(Attribute::InAlloca)) {
Out << "inalloca";
} else {
llvm_unreachable("unexpected type attr");
}
Out << Attribute::getNameFromAttrKind(Attr.getKindAsEnum());
if (Type *Ty = Attr.getValueAsType()) {
Out << '(';
TypePrinter.print(Ty, Out);