IR: Swap order of name and value in MDEnum

Put the name before the value in assembly for `MDEnum`.  While working
on the testcase upgrade script for the new hierarchy, I noticed that it
"looks nicer" to have the name first, since it lines the names up in the
(somewhat typical) case that they have a common prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-02-18 21:16:33 +00:00
parent 668aca9b4a
commit b5026b0b83
3 changed files with 9 additions and 9 deletions

View File

@ -3289,8 +3289,8 @@ bool LLParser::ParseMDSubrange(MDNode *&Result, bool IsDistinct) {
/// ::= !MDEnumerator(value: 30, name: "SomeKind")
bool LLParser::ParseMDEnumerator(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(value, MDSignedField, ); \
REQUIRED(name, MDStringField, );
REQUIRED(name, MDStringField, ); \
REQUIRED(value, MDSignedField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS

View File

@ -1361,8 +1361,8 @@ static void writeMDEnumerator(raw_ostream &Out, const MDEnumerator *N,
TypePrinting *, SlotTracker *, const Module *) {
Out << "!MDEnumerator(";
FieldSeparator FS;
Out << FS << "value: " << N->getValue();
Out << FS << "name: \"" << N->getName() << "\"";
Out << FS << "value: " << N->getValue();
Out << ")";
}

View File

@ -13,12 +13,12 @@
!2 = !MDSubrange(count: 3, lowerBound: 4)
!3 = !MDSubrange(count: 3, lowerBound: -5)
; CHECK-NEXT: !3 = !MDEnumerator(value: 7, name: "seven")
; CHECK-NEXT: !4 = !MDEnumerator(value: -8, name: "negeight")
; CHECK-NEXT: !5 = !MDEnumerator(value: 0, name: "")
!4 = !MDEnumerator(value: 7, name: "seven")
!5 = !MDEnumerator(value: -8, name: "negeight")
!6 = !MDEnumerator(value: 0, name: "")
; CHECK-NEXT: !3 = !MDEnumerator(name: "seven", value: 7)
; CHECK-NEXT: !4 = !MDEnumerator(name: "negeight", value: -8)
; CHECK-NEXT: !5 = !MDEnumerator(name: "", value: 0)
!4 = !MDEnumerator(name: "seven", value: 7)
!5 = !MDEnumerator(name: "negeight", value: -8)
!6 = !MDEnumerator(name: "", value: 0)
; CHECK-NEXT: !6 = !MDBasicType(tag: DW_TAG_base_type, name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
; CHECK-NEXT: !7 = !MDBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")