llvm/llvm/tools/dsymutil/dsymutil.cpp

//===- dsymutil.cpp - Debug info dumping utility for llvm -----------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This program is a utility that aims to be a dropin replacement for Darwin's
// dsymutil.
//===----------------------------------------------------------------------===//

#include "dsymutil.h"
#include "BinaryHolder.h"
#include "CFBundle.h"
#include "DebugMap.h"
#include "DwarfLinkerForBinary.h"
#include "LinkUtils.h"
#include "MachOUtils.h"
#include "Reproducer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/MachO.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/FileCollector.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/thread.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <string>
#include <system_error>

usingnamespacellvm;
usingnamespacellvm::dsymutil;
usingnamespaceobject;
usingnamespacellvm::dwarf_linker;

namespace {
enum ID {};

#define PREFIX
#include "Options.inc"
#undef PREFIX

usingnamespacellvm::opt;
static constexpr opt::OptTable::Info InfoTable[] =;

class DsymutilOptTable : public opt::GenericOptTable {};
} // namespace

enum class DWARFVerify : uint8_t {};

inline bool flagIsSet(DWARFVerify Flags, DWARFVerify SingleFlag) {}

struct DsymutilOptions {};

/// Return a list of input files. This function has logic for dealing with the
/// special case where we might have dSYM bundles as input. The function
/// returns an error when the directory structure doesn't match that of a dSYM
/// bundle.
static Expected<std::vector<std::string>> getInputs(opt::InputArgList &Args,
                                                    bool DsymAsInput) {}

// Verify that the given combination of options makes sense.
static Error verifyOptions(const DsymutilOptions &Options) {}

static Expected<DsymutilAccelTableKind>
getAccelTableKind(opt::InputArgList &Args) {}

static Expected<DsymutilDWARFLinkerType>
getDWARFLinkerType(opt::InputArgList &Args) {}

static Expected<ReproducerMode> getReproducerMode(opt::InputArgList &Args) {}

static Expected<DWARFVerify> getVerifyKind(opt::InputArgList &Args) {}

/// Parses the command line options into the LinkOptions struct and performs
/// some sanity checking. Returns an error in case the latter fails.
static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {}

static Error createPlistFile(StringRef Bin, StringRef BundleRoot,
                             StringRef Toolchain) {}

static Error createBundleDir(StringRef BundleBase) {}

static bool verifyOutput(StringRef OutputFile, StringRef Arch,
                         DsymutilOptions Options, std::mutex &Mutex) {}

namespace {
struct OutputLocation {};
} // namespace

static Expected<OutputLocation>
getOutputFileName(StringRef InputFile, const DsymutilOptions &Options) {}

int dsymutil_main(int argc, char **argv, const llvm::ToolContext &) {}