aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-02-15 04:15:55 +0000
committerAnna Zaks <ganna@apple.com>2013-02-15 04:15:55 +0000
commita7e4409bb238ec3c5169c25afbb0308ae76d1111 (patch)
tree60cf13dbc3cb123cebc073ea9b6a425f72b0bf00 /lib
parente7210257829522973777851a1fd6e44d82e36fbc (diff)
downloadexternal_llvm-a7e4409bb238ec3c5169c25afbb0308ae76d1111.zip
external_llvm-a7e4409bb238ec3c5169c25afbb0308ae76d1111.tar.gz
external_llvm-a7e4409bb238ec3c5169c25afbb0308ae76d1111.tar.bz2
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
Diffstat (limited to 'lib')
-rw-r--r--lib/IR/Attributes.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index 629679c..3de304e 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -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 (isStringAttribute()) {
+ if (!AI.isStringAttribute()) return false;
+ if (getKindAsString() < AI.getKindAsString()) return true;
+ if (getKindAsString() == AI.getKindAsString())
+ return getValueAsString() < AI.getValueAsString();
}
- if (AI.isEnumAttribute()) return false;
- if (AI.isAlignAttribute()) return false;
- if (getKindAsString() == AI.getKindAsString())
- return getValueAsString() < AI.getValueAsString();
- return getKindAsString() < AI.getKindAsString();
+ return false;
}
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {