#include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/COFFModuleDefinition.h"
#include "llvm/Object/WindowsMachineFlag.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/OptTable.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespacellvm;
usingnamespacellvm::object;
namespace {
enum { … };
#define PREFIX …
#include "Options.inc"
#undef PREFIX
usingnamespacellvm::opt;
static constexpr opt::OptTable::Info InfoTable[] = …;
class LibOptTable : public opt::GenericOptTable { … };
}
static std::string getDefaultOutputPath(const NewArchiveMember &FirstMember) { … }
static std::vector<StringRef> getSearchPaths(opt::InputArgList *Args,
StringSaver &Saver) { … }
std::unique_ptr<MemoryBuffer> openFile(const Twine &Path) { … }
static std::string findInputFile(StringRef File, ArrayRef<StringRef> Paths) { … }
static void fatalOpenError(llvm::Error E, Twine File) { … }
static void doList(opt::InputArgList &Args) { … }
static Expected<COFF::MachineTypes> getCOFFFileMachine(MemoryBufferRef MB) { … }
static Expected<COFF::MachineTypes> getBitcodeFileMachine(MemoryBufferRef MB) { … }
static bool machineMatches(COFF::MachineTypes LibMachine,
COFF::MachineTypes FileMachine) { … }
static void appendFile(std::vector<NewArchiveMember> &Members,
COFF::MachineTypes &LibMachine,
std::string &LibMachineSource, MemoryBufferRef MB) { … }
int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) { … }