mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Unify the adding of enumerators with the construction of the enumeration.
llvm-svn: 194401
This commit is contained in:
parent
bbbbc2a7b7
commit
67515d7632
@ -1137,21 +1137,9 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
|
|||||||
case dwarf::DW_TAG_array_type:
|
case dwarf::DW_TAG_array_type:
|
||||||
constructArrayTypeDIE(Buffer, CTy);
|
constructArrayTypeDIE(Buffer, CTy);
|
||||||
break;
|
break;
|
||||||
case dwarf::DW_TAG_enumeration_type: {
|
case dwarf::DW_TAG_enumeration_type:
|
||||||
DIArray Elements = CTy.getTypeArray();
|
constructEnumTypeDIE(Buffer, CTy);
|
||||||
|
break;
|
||||||
// Add enumerators to enumeration type.
|
|
||||||
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
|
|
||||||
DIDescriptor Enum(Elements.getElement(i));
|
|
||||||
if (Enum.isEnumerator())
|
|
||||||
constructEnumTypeDIE(Buffer, DIEnumerator(Enum));
|
|
||||||
}
|
|
||||||
DIType DTy = resolve(CTy.getTypeDerivedFrom());
|
|
||||||
if (DTy) {
|
|
||||||
addType(&Buffer, DTy);
|
|
||||||
addFlag(&Buffer, dwarf::DW_AT_enum_class);
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case dwarf::DW_TAG_subroutine_type: {
|
case dwarf::DW_TAG_subroutine_type: {
|
||||||
// Add return type. A void return won't have a type.
|
// Add return type. A void return won't have a type.
|
||||||
DIArray Elements = CTy.getTypeArray();
|
DIArray Elements = CTy.getTypeArray();
|
||||||
@ -1720,13 +1708,27 @@ void CompileUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
/// constructEnumTypeDIE - Construct an enum type DIE from DICompositeType.
|
||||||
void CompileUnit::constructEnumTypeDIE(DIE &Buffer, DIEnumerator ETy) {
|
void CompileUnit::constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy) {
|
||||||
DIE *Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
|
DIArray Elements = CTy.getTypeArray();
|
||||||
StringRef Name = ETy.getName();
|
|
||||||
addString(Enumerator, dwarf::DW_AT_name, Name);
|
// Add enumerators to enumeration type.
|
||||||
int64_t Value = ETy.getEnumValue();
|
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
|
||||||
addSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
|
DIDescriptor Enum(Elements.getElement(i));
|
||||||
|
DIEnumerator ETy = DIEnumerator(Enum);
|
||||||
|
if (Enum.isEnumerator()) {
|
||||||
|
DIE *Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
|
||||||
|
StringRef Name = ETy.getName();
|
||||||
|
addString(Enumerator, dwarf::DW_AT_name, Name);
|
||||||
|
int64_t Value = ETy.getEnumValue();
|
||||||
|
addSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DIType DTy = resolve(CTy.getTypeDerivedFrom());
|
||||||
|
if (DTy) {
|
||||||
|
addType(&Buffer, DTy);
|
||||||
|
addFlag(&Buffer, dwarf::DW_AT_enum_class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// constructContainingTypeDIEs - Construct DIEs for types that contain
|
/// constructContainingTypeDIEs - Construct DIEs for types that contain
|
||||||
|
@ -351,7 +351,7 @@ private:
|
|||||||
void constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy);
|
void constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy);
|
||||||
|
|
||||||
/// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
/// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
||||||
void constructEnumTypeDIE(DIE &Buffer, DIEnumerator ETy);
|
void constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy);
|
||||||
|
|
||||||
/// constructMemberDIE - Construct member DIE from DIDerivedType.
|
/// constructMemberDIE - Construct member DIE from DIDerivedType.
|
||||||
void constructMemberDIE(DIE &Buffer, DIDerivedType DT);
|
void constructMemberDIE(DIE &Buffer, DIDerivedType DT);
|
||||||
|
Loading…
Reference in New Issue
Block a user