1*7a6dacacSDimitry Andric //=== DWARFLinkerBase.cpp -------------------------------------------------===// 2*7a6dacacSDimitry Andric // 3*7a6dacacSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*7a6dacacSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*7a6dacacSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*7a6dacacSDimitry Andric // 7*7a6dacacSDimitry Andric //===----------------------------------------------------------------------===// 8*7a6dacacSDimitry Andric 9*7a6dacacSDimitry Andric #include "llvm/DWARFLinker/DWARFLinkerBase.h" 10*7a6dacacSDimitry Andric #include "llvm/ADT/StringSwitch.h" 11*7a6dacacSDimitry Andric 12*7a6dacacSDimitry Andric using namespace llvm; 13*7a6dacacSDimitry Andric using namespace llvm::dwarf_linker; 14*7a6dacacSDimitry Andric 15*7a6dacacSDimitry Andric std::optional<DebugSectionKind> 16*7a6dacacSDimitry Andric llvm::dwarf_linker::parseDebugTableName(llvm::StringRef SecName) { 17*7a6dacacSDimitry Andric return llvm::StringSwitch<std::optional<DebugSectionKind>>( 18*7a6dacacSDimitry Andric SecName.substr(SecName.find_first_not_of("._"))) 19*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugInfo), 20*7a6dacacSDimitry Andric DebugSectionKind::DebugInfo) 21*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugLine), 22*7a6dacacSDimitry Andric DebugSectionKind::DebugLine) 23*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugFrame), 24*7a6dacacSDimitry Andric DebugSectionKind::DebugFrame) 25*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugRange), 26*7a6dacacSDimitry Andric DebugSectionKind::DebugRange) 27*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugRngLists), 28*7a6dacacSDimitry Andric DebugSectionKind::DebugRngLists) 29*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugLoc), 30*7a6dacacSDimitry Andric DebugSectionKind::DebugLoc) 31*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugLocLists), 32*7a6dacacSDimitry Andric DebugSectionKind::DebugLocLists) 33*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugARanges), 34*7a6dacacSDimitry Andric DebugSectionKind::DebugARanges) 35*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugAbbrev), 36*7a6dacacSDimitry Andric DebugSectionKind::DebugAbbrev) 37*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugMacinfo), 38*7a6dacacSDimitry Andric DebugSectionKind::DebugMacinfo) 39*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugMacro), 40*7a6dacacSDimitry Andric DebugSectionKind::DebugMacro) 41*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugAddr), 42*7a6dacacSDimitry Andric DebugSectionKind::DebugAddr) 43*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugStr), 44*7a6dacacSDimitry Andric DebugSectionKind::DebugStr) 45*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugLineStr), 46*7a6dacacSDimitry Andric DebugSectionKind::DebugLineStr) 47*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugStrOffsets), 48*7a6dacacSDimitry Andric DebugSectionKind::DebugStrOffsets) 49*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugPubNames), 50*7a6dacacSDimitry Andric DebugSectionKind::DebugPubNames) 51*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugPubTypes), 52*7a6dacacSDimitry Andric DebugSectionKind::DebugPubTypes) 53*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::DebugNames), 54*7a6dacacSDimitry Andric DebugSectionKind::DebugNames) 55*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::AppleNames), 56*7a6dacacSDimitry Andric DebugSectionKind::AppleNames) 57*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::AppleNamespaces), 58*7a6dacacSDimitry Andric DebugSectionKind::AppleNamespaces) 59*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::AppleObjC), 60*7a6dacacSDimitry Andric DebugSectionKind::AppleObjC) 61*7a6dacacSDimitry Andric .Case(getSectionName(DebugSectionKind::AppleTypes), 62*7a6dacacSDimitry Andric DebugSectionKind::AppleTypes) 63*7a6dacacSDimitry Andric .Default(std::nullopt); 64*7a6dacacSDimitry Andric } 65