llvm/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp

//===-- llvm-libtool-darwin.cpp - a tool for creating libraries -----------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// A utility for creating static and dynamic libraries for Darwin.
//
//===----------------------------------------------------------------------===//

#include "DependencyInfo.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/IRObjectFile.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/MachOUniversalWriter.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TextAPI/Architecture.h"
#include <cstdlib>
#include <map>
#include <type_traits>

usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::opt;

// Command-line option boilerplate.
namespace {
enum ID {};

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

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

class LibtoolDarwinOptTable : public opt::GenericOptTable {};
} // end anonymous namespace

class NewArchiveMemberList;
MembersPerArchitectureMap;

static std::string OutputFile;
static std::vector<std::string> InputFiles;
static std::optional<std::string> ArchType;

enum class Operation {};
static Operation LibraryOperation =;

static bool DeterministicOption;
static bool NonDeterministicOption;
static std::string FileList;
static std::vector<std::string> Libraries;
static std::vector<std::string> LibrarySearchDirs;
static std::string DependencyInfoPath;
static bool VersionOption;
static bool NoWarningForNoSymbols;
static bool WarningsAsErrors;
static std::string IgnoredSyslibRoot;

static const std::array<std::string, 3> StandardSearchDirs{};

std::unique_ptr<DependencyInfo> GlobalDependencyInfo;

struct Config {};

static Expected<std::string> searchForFile(const Twine &FileName) {}

static Error processCommandLineLibraries() {}

static Error processFileList() {}

static Error validateArchitectureName(StringRef ArchitectureName) {}

static uint64_t getCPUID(uint32_t CPUType, uint32_t CPUSubtype) {}

// MembersData is an organized collection of members.
struct MembersData {};

// NewArchiveMemberList instances serve as collections of archive members and
// information about those members.
class NewArchiveMemberList {};

// MembersBuilder collects and organizes all members from the files provided by
// the user.
class MembersBuilder {};

static Expected<SmallVector<Slice, 2>>
buildSlices(LLVMContext &LLVMCtx,
            ArrayRef<OwningBinary<Archive>> OutputBinaries) {}

static Error
checkForDuplicates(const MembersPerArchitectureMap &MembersPerArch) {}

static Error createStaticLibrary(LLVMContext &LLVMCtx, const Config &C) {}

static void parseRawArgs(int Argc, char **Argv) {}

static Expected<Config> parseCommandLine(int Argc, char **Argv) {}

int llvm_libtool_darwin_main(int Argc, char **Argv, const llvm::ToolContext &) {}