#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/WithColor.h"
#include <system_error>
usingnamespacellvm;
static cl::OptionCategory DisCategory("Disassembler Options");
static cl::list<std::string> InputFilenames(cl::Positional,
cl::desc("[input bitcode]..."),
cl::cat(DisCategory));
static cl::opt<std::string> OutputFilename("o",
cl::desc("Override output filename"),
cl::value_desc("filename"),
cl::cat(DisCategory));
static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"),
cl::cat(DisCategory));
static cl::opt<bool> DontPrint("disable-output",
cl::desc("Don't output the .ll file"),
cl::Hidden, cl::cat(DisCategory));
static cl::opt<bool>
SetImporting("set-importing",
cl::desc("Set lazy loading to pretend to import a module"),
cl::Hidden, cl::cat(DisCategory));
static cl::opt<bool>
ShowAnnotations("show-annotations",
cl::desc("Add informational comments to the .ll file"),
cl::cat(DisCategory));
static cl::opt<bool> PreserveAssemblyUseListOrder(
"preserve-ll-uselistorder",
cl::desc("Preserve use-list order when writing LLVM assembly."),
cl::init(false), cl::Hidden, cl::cat(DisCategory));
static cl::opt<bool>
MaterializeMetadata("materialize-metadata",
cl::desc("Load module without materializing metadata, "
"then materialize only the metadata"),
cl::cat(DisCategory));
static cl::opt<bool> PrintThinLTOIndexOnly(
"print-thinlto-index-only",
cl::desc("Only read thinlto index and print the index as LLVM assembly."),
cl::init(false), cl::Hidden, cl::cat(DisCategory));
extern cl::opt<bool> WriteNewDbgInfoFormat;
extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInfoFormat;
namespace {
static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) { … }
class CommentWriter : public AssemblyAnnotationWriter { … };
struct LLVMDisDiagnosticHandler : public DiagnosticHandler { … };
}
static ExitOnError ExitOnErr;
int main(int argc, char **argv) { … }