#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/WithColor.h"
#include <string>
#include <system_error>
usingnamespacellvm;
static cl::OptionCategory cat("split-file Options");
static cl::opt<std::string> input(cl::Positional, cl::desc("filename"),
cl::cat(cat));
static cl::opt<std::string> output(cl::Positional, cl::desc("directory"),
cl::value_desc("directory"), cl::cat(cat));
static cl::opt<bool> leadingLines("leading-lines",
cl::desc("Preserve line numbers"),
cl::cat(cat));
static cl::opt<bool> noLeadingLines("no-leading-lines",
cl::desc("Don't preserve line numbers (default)"),
cl::cat(cat));
static StringRef toolName;
static int errorCount;
[[noreturn]] static void fatal(StringRef filename, const Twine &message) { … }
static void error(StringRef filename, int64_t line, const Twine &message) { … }
namespace {
struct Part { … };
}
static int handle(MemoryBuffer &inputBuf, StringRef input) { … }
int main(int argc, const char **argv) { … }