+/// ParseFile - this function begins the parsing of the specified tablegen
+/// file.
+static bool ParseFile(const std::string &Filename,
+ const std::vector<std::string> &IncludeDirs) {
+ std::string ErrorStr;
+ MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
+ if (F == 0) {
+ cerr << "Could not open input file '" + Filename + "': " << ErrorStr <<"\n";
+ return true;
+ }
+
+ TGParser Parser(F);
+
+ // Record the location of the include directory so that the lexer can find
+ // it later.
+ Parser.setIncludeDirs(IncludeDirs);
+
+ return Parser.ParseFile();
+}
+