29 #include <system_error> 54 errs() << ProgName <<
": " << Msg;
65 return reportError(argv0,
"the option -d must be used together with -o\n");
74 DepOut.
os() <<
' ' << Dep.first;
87 if (std::error_code EC = FileOrErr.
getError())
89 "': " + EC.message() +
"\n");
104 std::string OutString;
106 if (MainFn(Out, Records))
122 if (std::move(ExistingOrErr.get())->getBuffer() == Out.
str())
129 EC.message() +
"\n");
130 OutFile.
os() << Out.
str();
Represents either an error or a value T.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
This class represents lattice values for constants.
static cl::list< std::string > MacroNames("D", cl::desc("Name of the macro to be defined"), cl::value_desc("macro name"), cl::Prefix)
static cl::list< std::string > IncludeDirs("I", cl::desc("Directory of include files"), cl::value_desc("directory"), cl::Prefix)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
static cl::opt< std::string > DependFilename("d", cl::desc("Dependency filename"), cl::value_desc("filename"), cl::init(""))
initializer< Ty > init(const Ty &Val)
std::error_code getError() const
int TableGenMain(char *argv0, TableGenMainFn *MainFn)
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
const TGLexer::DependenciesMapTy & getDependencies() const
static int reportError(const char *ProgName, Twine Msg)
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
bool(raw_ostream &OS, RecordKeeper &Records) TableGenMainFn
Perform the action using Records, and write output to OS.
bool ParseFile()
ParseFile - Main entrypoint for parsing a tblgen file.
static cl::opt< std::string > InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"))
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
A raw_ostream that writes to an std::string.
void setIncludeDirs(const std::vector< std::string > &Dirs)
static int createDependencyFile(const TGParser &Parser, const char *argv0)
Create a dependency file for -d option.
Represents a location in source code.