#include "clang/Basic/Version.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/OffloadBinary.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/WithColor.h"
usingnamespacellvm;
usingnamespacellvm::object;
static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden);
static cl::OptionCategory
ClangOffloadPackagerCategory("clang-offload-packager options");
static cl::opt<std::string> OutputFile("o", cl::desc("Write output to <file>."),
cl::value_desc("file"),
cl::cat(ClangOffloadPackagerCategory));
static cl::opt<std::string> InputFile(cl::Positional,
cl::desc("Extract from <file>."),
cl::value_desc("file"),
cl::cat(ClangOffloadPackagerCategory));
static cl::list<std::string>
DeviceImages("image",
cl::desc("List of key and value arguments. Required keywords "
"are 'file' and 'triple'."),
cl::value_desc("<key>=<value>,..."),
cl::cat(ClangOffloadPackagerCategory));
static cl::opt<bool>
CreateArchive("archive",
cl::desc("Write extracted files to a static archive"),
cl::cat(ClangOffloadPackagerCategory));
static const char *PackagerExecutable;
static void PrintVersion(raw_ostream &OS) { … }
static DenseMap<StringRef, StringRef> getImageArguments(StringRef Image,
StringSaver &Saver) { … }
static Error writeFile(StringRef Filename, StringRef Data) { … }
static Error bundleImages() { … }
static Error unbundleImages() { … }
int main(int argc, const char **argv) { … }