diff --git a/llvm/lib/ObjectYAML/CMakeLists.txt b/llvm/lib/ObjectYAML/CMakeLists.txt --- a/llvm/lib/ObjectYAML/CMakeLists.txt +++ b/llvm/lib/ObjectYAML/CMakeLists.txt @@ -8,6 +8,7 @@ DWARFEmitter.cpp DWARFVisitor.cpp DWARFYAML.cpp + DWARFYAMLUtils.cpp ELFEmitter.cpp ELFYAML.cpp MachOEmitter.cpp diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp --- a/llvm/lib/ObjectYAML/DWARFYAML.cpp +++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp @@ -16,39 +16,6 @@ namespace llvm { -bool DWARFYAML::Data::isEmpty() const { - return DebugStrings.empty() && AbbrevDecls.empty() && ARanges.empty() && - DebugRanges.empty() && !PubNames && !PubTypes && !GNUPubNames && - !GNUPubTypes && CompileUnits.empty() && DebugLines.empty(); -} - -SetVector DWARFYAML::Data::getUsedSectionNames() const { - SetVector SecNames; - if (!DebugStrings.empty()) - SecNames.insert("debug_str"); - if (!ARanges.empty()) - SecNames.insert("debug_aranges"); - if (!DebugRanges.empty()) - SecNames.insert("debug_ranges"); - if (!DebugLines.empty()) - SecNames.insert("debug_line"); - if (!DebugAddr.empty()) - SecNames.insert("debug_addr"); - if (!AbbrevDecls.empty()) - SecNames.insert("debug_abbrev"); - if (!CompileUnits.empty()) - SecNames.insert("debug_info"); - if (PubNames) - SecNames.insert("debug_pubnames"); - if (PubTypes) - SecNames.insert("debug_pubtypes"); - if (GNUPubNames) - SecNames.insert("debug_gnu_pubnames"); - if (GNUPubTypes) - SecNames.insert("debug_gnu_pubtypes"); - return SecNames; -} - namespace yaml { void MappingTraits::mapping(IO &IO, DWARFYAML::Data &DWARF) { diff --git a/llvm/lib/ObjectYAML/DWARFYAMLUtils.cpp b/llvm/lib/ObjectYAML/DWARFYAMLUtils.cpp new file mode 100644 --- /dev/null +++ b/llvm/lib/ObjectYAML/DWARFYAMLUtils.cpp @@ -0,0 +1,50 @@ +//===- DWARFYAMLUtils.cpp - -------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// \file +/// This file contains implementations for member functions in DWARFYAML. +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/SetVector.h" +#include "llvm/ObjectYAML/DWARFYAML.h" + +namespace llvm { + +bool DWARFYAML::Data::isEmpty() const { + return DebugStrings.empty() && AbbrevDecls.empty() && ARanges.empty() && + DebugRanges.empty() && !PubNames && !PubTypes && !GNUPubNames && + !GNUPubTypes && CompileUnits.empty() && DebugLines.empty(); +} + +SetVector DWARFYAML::Data::getUsedSectionNames() const { + SetVector SecNames; + if (!DebugStrings.empty()) + SecNames.insert("debug_str"); + if (!ARanges.empty()) + SecNames.insert("debug_aranges"); + if (!DebugRanges.empty()) + SecNames.insert("debug_ranges"); + if (!DebugLines.empty()) + SecNames.insert("debug_line"); + if (!DebugAddr.empty()) + SecNames.insert("debug_addr"); + if (!AbbrevDecls.empty()) + SecNames.insert("debug_abbrev"); + if (!CompileUnits.empty()) + SecNames.insert("debug_info"); + if (PubNames) + SecNames.insert("debug_pubnames"); + if (PubTypes) + SecNames.insert("debug_pubtypes"); + if (GNUPubNames) + SecNames.insert("debug_gnu_pubnames"); + if (GNUPubTypes) + SecNames.insert("debug_gnu_pubtypes"); + return SecNames; +} + +} // end namespace llvm