Index: include/llvm/Support/Dwarf.h =================================================================== --- include/llvm/Support/Dwarf.h +++ include/llvm/Support/Dwarf.h @@ -950,6 +950,10 @@ }; }; +/// Returns the symbolic string representing Val when used as a value +/// for attribute Attr. +const char *AttributeValueString(uint16_t Attr, unsigned Val); + } // End of namespace dwarf } // End of namespace llvm Index: lib/DebugInfo/DWARFDebugInfoEntry.cpp =================================================================== --- lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -86,7 +86,18 @@ return; OS << "\t("; - formValue.dump(OS, u); + + Optional Val = formValue.getAsUnsignedConstant(); + const char *Name = nullptr; + if (Val) + Name = AttributeValueString(attr, Val.getValue()); + + if (Name) { + OS << Name; + } else { + formValue.dump(OS, u); + } + OS << ")\n"; } Index: lib/Support/Dwarf.cpp =================================================================== --- lib/Support/Dwarf.cpp +++ lib/Support/Dwarf.cpp @@ -795,3 +795,36 @@ } llvm_unreachable("Unknown GDBIndexEntryLinkage value"); } + +const char *llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) { + switch (Attr) { + case DW_AT_accessibility: + return AccessibilityString(Val); + case DW_AT_virtuality: + return VirtualityString(Val); + case DW_AT_language: + return LanguageString(Val); + case DW_AT_encoding: + return AttributeEncodingString(Val); + case DW_AT_decimal_sign: + return DecimalSignString(Val); + case DW_AT_endianity: + return EndianityString(Val); + case DW_AT_visibility: + return VisibilityString(Val); + case DW_AT_identifier_case: + return CaseString(Val); + case DW_AT_calling_convention: + return ConventionString(Val); + case DW_AT_inline: + return InlineCodeString(Val); + case DW_AT_ordering: + return ArrayOrderString(Val); + case DW_AT_discr_value: + return DiscriminantString(Val); + default: + return nullptr; + } + + return nullptr; +} Index: test/DebugInfo/X86/debug-info-access.ll =================================================================== --- test/DebugInfo/X86/debug-info-access.ll +++ test/DebugInfo/X86/debug-info-access.ll @@ -46,22 +46,22 @@ ; ; CHECK: DW_TAG_inheritance ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_accessibility {{.*}}(0x01) +; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) ; ; CHECK: DW_TAG_member ; CHECK: DW_AT_name {{.*}}"public_static") ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_accessibility {{.*}}(0x01) +; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) ; ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}}"pub") ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_accessibility {{.*}}(0x01) +; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public) ; ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}}"prot") ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_accessibility {{.*}}(0x02) +; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected) ; ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}}"priv_default") @@ -71,7 +71,7 @@ ; CHECK: DW_TAG_member ; CHECK: DW_AT_name {{.*}}"union_priv") ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_accessibility {{.*}}(0x03) +; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_private) ; ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}}"union_pub_default") Index: test/DebugInfo/X86/debug-info-static-member.ll =================================================================== --- test/DebugInfo/X86/debug-info-static-member.ll +++ test/DebugInfo/X86/debug-info-static-member.ll @@ -101,33 +101,33 @@ ; PRESENT-NEXT: DW_AT_name {{.*}} "a" ; PRESENT: DW_AT_external ; PRESENT: DW_AT_declaration -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x03) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private) ; PRESENT: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "const_a" ; PRESENT: DW_AT_external ; PRESENT: DW_AT_declaration -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x03) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private) ; PRESENT: DW_AT_const_value {{.*}} (1) ; PRESENT: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "b" -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected) ; PRESENT: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "const_b" -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected) ; PRESENT: DW_AT_const_value [DW_FORM_udata] (1078523331) ; PRESENT: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "c" -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; PRESENT: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "const_c" -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; PRESENT: DW_AT_const_value {{.*}} (18) ; While we're here, a normal member has data_member_location and ; accessibility attributes. ; PRESENT: DW_TAG_member ; PRESENT-NEXT: DW_AT_name {{.*}} "d" ; PRESENT: DW_AT_data_member_location -; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01) +; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; PRESENT: NULL ; Definitions point back to their declarations, and have a location. ; PRESENT: DW_TAG_variable @@ -151,33 +151,33 @@ ; DARWINP-NEXT: DW_AT_name {{.*}} "a" ; DARWINP: DW_AT_external ; DARWINP: DW_AT_declaration -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private) ; DARWINP: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "const_a" ; DARWINP: DW_AT_external ; DARWINP: DW_AT_declaration -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private) ; DARWINP: DW_AT_const_value {{.*}} (1) ; DARWINP: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "b" -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected) ; DARWINP: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "const_b" -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected) ; DARWINP: DW_AT_const_value [DW_FORM_udata] (1078523331) ; DARWINP: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "c" -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; DARWINP: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "const_c" -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; DARWINP: DW_AT_const_value {{.*}} (18) ; While we're here, a normal member has data_member_location and ; accessibility attributes. ; DARWINP: DW_TAG_member ; DARWINP-NEXT: DW_AT_name {{.*}} "d" ; DARWINP: DW_AT_data_member_location -; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01) +; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; DARWINP: NULL ; Definitions point back to their declarations, and have a location. ; DARWINP: DW_TAG_variable Index: test/DebugInfo/X86/empty-and-one-elem-array.ll =================================================================== --- test/DebugInfo/X86/empty-and-one-elem-array.ll +++ test/DebugInfo/X86/empty-and-one-elem-array.ll @@ -30,7 +30,7 @@ ; CHECK: DW_TAG_base_type ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "int") -; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05) +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed) ; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04) ; int foo::b[1]: Index: test/DebugInfo/X86/empty-array.ll =================================================================== --- test/DebugInfo/X86/empty-array.ll +++ test/DebugInfo/X86/empty-array.ll @@ -22,7 +22,7 @@ ; CHECK: [[BASE2]]: DW_TAG_base_type ; CHECK-NEXT: DW_AT_name ; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x08) -; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x07) +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_unsigned) !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!21} Index: test/DebugInfo/X86/fission-cu.ll =================================================================== --- test/DebugInfo/X86/fission-cu.ll +++ test/DebugInfo/X86/fission-cu.ll @@ -65,7 +65,7 @@ ; CHECK: .debug_info.dwo contents: ; CHECK: DW_TAG_compile_unit ; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)") -; CHECK: DW_AT_language [DW_FORM_data2] (0x000c) +; CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99) ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c") ; CHECK-NOT: DW_AT_low_pc ; CHECK-NOT: DW_AT_stmt_list Index: test/DebugInfo/X86/nondefault-subrange-array.ll =================================================================== --- test/DebugInfo/X86/nondefault-subrange-array.ll +++ test/DebugInfo/X86/nondefault-subrange-array.ll @@ -25,7 +25,7 @@ ; CHECK: [[BASE2]]: DW_TAG_base_type ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "sizetype") ; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x08) -; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x07) +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_unsigned) !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!21} Index: test/Linker/type-unique-simple2-a.ll =================================================================== --- test/Linker/type-unique-simple2-a.ll +++ test/Linker/type-unique-simple2-a.ll @@ -19,7 +19,7 @@ ; } ; ; CHECK: _ZN1A6setFooEv -; CHECK: DW_AT_accessibility [DW_FORM_data1] (0x01) +; CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; CHECK-NOT: DW_AT_accessibility ; CHECK: DW_TAG