Revert "Simplify the attributes '<' comparison function."

This reverts commit 82c101153fe7b35bce48781fab038e1b8f31a7bd.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anna Zaks 2013-02-15 04:15:55 +00:00
parent e721025782
commit a7e4409bb2

View File

@ -332,23 +332,25 @@ StringRef AttributeImpl::getValueAsString() const {
bool AttributeImpl::operator<(const AttributeImpl &AI) const {
// This sorts the attributes with Attribute::AttrKinds coming first (sorted
// relative to their enum value) and then strings.
if (isEnumAttribute()) {
if (AI.isEnumAttribute()) return getKindAsEnum() < AI.getKindAsEnum();
if (AI.isAlignAttribute()) return true;
if (AI.isStringAttribute()) return true;
}
if (isEnumAttribute())
if (AI.isAlignAttribute() || AI.isEnumAttribute())
return getKindAsEnum() < AI.getKindAsEnum();
if (isAlignAttribute()) {
if (AI.isEnumAttribute()) return false;
if (AI.isAlignAttribute()) return getValueAsInt() < AI.getValueAsInt();
if (AI.isStringAttribute()) return true;
if (!AI.isStringAttribute() && getKindAsEnum() < AI.getKindAsEnum())
return true;
if (AI.isAlignAttribute())
return getValueAsInt() < AI.getValueAsInt();
}
if (AI.isEnumAttribute()) return false;
if (AI.isAlignAttribute()) return false;
if (getKindAsString() == AI.getKindAsString())
return getValueAsString() < AI.getValueAsString();
return getKindAsString() < AI.getKindAsString();
if (isStringAttribute()) {
if (!AI.isStringAttribute()) return false;
if (getKindAsString() < AI.getKindAsString()) return true;
if (getKindAsString() == AI.getKindAsString())
return getValueAsString() < AI.getValueAsString();
}
return false;
}
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {