#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/ProfileData/CtxInstrContextNode.h"
#include "llvm/ProfileData/PGOCtxProfWriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
static cl::SubCommand FromJSON("fromJSON", "Convert from json");
static cl::opt<std::string> InputFilename(
"input", cl::value_desc("input"), cl::init("-"),
cl::desc(
"Input file. The format is an array of contexts.\n"
"Each context is a dictionary with the following keys:\n"
"'Guid', mandatory. The value is a 64-bit integer.\n"
"'Counters', mandatory. An array of 32-bit ints. These are the "
"counter values.\n"
"'Contexts', optional. An array containing arrays of contexts. The "
"context array at a position 'i' is the set of callees at that "
"callsite index. Use an empty array to indicate no callees."),
cl::sub(FromJSON));
static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
cl::init("-"),
cl::desc("Output file"),
cl::sub(FromJSON));
Error convertFromJSON() { … }
int main(int argc, const char **argv) { … }