[llvm] e0802fe - DebugInfo: Tidy up initializing multi-section contributions in DWARFContext
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 10:55:29 PDT 2020
Author: David Blaikie
Date: 2020-09-18T10:54:43-07:00
New Revision: e0802fe0162fcab12de5f134dc0848a8e4dfbc92
URL: https://github.com/llvm/llvm-project/commit/e0802fe0162fcab12de5f134dc0848a8e4dfbc92
DIFF: https://github.com/llvm/llvm-project/commit/e0802fe0162fcab12de5f134dc0848a8e4dfbc92.diff
LOG: DebugInfo: Tidy up initializing multi-section contributions in DWARFContext
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 47eba48c279d..c2d906427033 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1711,16 +1711,17 @@ class DWARFObjInMemory final : public DWARFObject {
// FIXME: Use the other dwo range section when we emit it.
RangesDWOSection.Data = Data;
}
- } else if (Name == "debug_info") {
+ } else if (InfoSectionMap *Sections =
+ StringSwitch<InfoSectionMap *>(Name)
+ .Case("debug_info", &InfoSections)
+ .Case("debug_info.dwo", &InfoDWOSections)
+ .Case("debug_types", &TypesSections)
+ .Case("debug_types.dwo", &TypesDWOSections)
+ .Default(nullptr)) {
// Find debug_info and debug_types data by section rather than name as
// there are multiple, comdat grouped, of these sections.
- InfoSections[Section].Data = Data;
- } else if (Name == "debug_info.dwo") {
- InfoDWOSections[Section].Data = Data;
- } else if (Name == "debug_types") {
- TypesSections[Section].Data = Data;
- } else if (Name == "debug_types.dwo") {
- TypesDWOSections[Section].Data = Data;
+ DWARFSectionMap &S = (*Sections)[Section];
+ S.Data = Data;
}
if (RelocatedSection == Obj.section_end())
More information about the llvm-commits
mailing list