llvm/llvm/tools/llvm-cgdata/llvm-cgdata.cpp

//===-- llvm-cgdata.cpp - LLVM CodeGen Data Tool --------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// llvm-cgdata parses raw codegen data embedded in compiled binary files, and
// merges them into a single .cgdata file. It can also inspect and maninuplate
// a .cgdata file. This .cgdata can contain various codegen data like outlining
// information, and it can be used to optimize the code in the subsequent build.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringRef.h"
#include "llvm/CGData/CodeGenDataReader.h"
#include "llvm/CGData/CodeGenDataWriter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/Binary.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"

usingnamespacellvm;
usingnamespacellvm::object;

enum CGDataFormat {};

enum CGDataAction {};

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

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

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

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

// Options
static StringRef ToolName;
static StringRef OutputFilename =;
static StringRef Filename;
static bool ShowCGDataVersion;
static CGDataAction Action;
static std::optional<CGDataFormat> OutputFormat;
static std::vector<std::string> InputFilenames;

// TODO: Add a doc, https://llvm.org/docs/CommandGuide/llvm-cgdata.html

static void exitWithError(Twine Message, std::string Whence = "",
                          std::string Hint = "") {}

static void exitWithError(Error E, StringRef Whence = "") {}

static void exitWithErrorCode(std::error_code EC, StringRef Whence = "") {}

static int convert_main(int argc, const char *argv[]) {}

static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
                         OutlinedHashTreeRecord &GlobalOutlineRecord);

static bool handleArchive(StringRef Filename, Archive &Arch,
                          OutlinedHashTreeRecord &GlobalOutlineRecord) {}

static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
                         OutlinedHashTreeRecord &GlobalOutlineRecord) {}

static bool handleFile(StringRef Filename,
                       OutlinedHashTreeRecord &GlobalOutlineRecord) {}

static int merge_main(int argc, const char *argv[]) {}

static int show_main(int argc, const char *argv[]) {}

static void parseArgs(int argc, char **argv) {}

int llvm_cgdata_main(int argc, char **argvNonConst, const llvm::ToolContext &) {}