%x comment
%{
+#include "llvm/Config/config.h"
+#include "llvm/Support/Streams.h"
#include "Record.h"
typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy;
#include "FileParser.h"
///
static int ParseInt(const char *Str) {
if (Str[0] == '0' && Str[1] == 'b')
- return strtol(Str+2, 0, 2);
- return strtol(Str, 0, 0);
+ return strtoll(Str+2, 0, 2);
+ return strtoll(Str, 0, 0);
}
static int CommentDepth = 0;
static std::vector<IncludeRec> IncludeStack;
std::ostream &err() {
- if (IncludeStack.empty())
- return std::cerr << "At end of input: ";
+ if (IncludeStack.empty()) {
+ cerr << "At end of input: ";
+ return *cerr.stream();
+ }
for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i)
- std::cerr << "Included from " << IncludeStack[i].Filename << ":"
- << IncludeStack[i].LineNo << ":\n";
- return std::cerr << "Parsing " << IncludeStack.back().Filename << ":"
- << Filelineno << ": ";
+ cerr << "Included from " << IncludeStack[i].Filename << ":"
+ << IncludeStack[i].LineNo << ":\n";
+ cerr << "Parsing " << IncludeStack.back().Filename << ":"
+ << Filelineno << ": ";
+ return *cerr.stream();
}
/// ParseFile - this function begins the parsing of the specified tablegen file.
F = fopen(Filename.c_str(), "r");
if (F == 0) {
- std::cerr << "Could not open input file '" + Filename + "'!\n";
+ cerr << "Could not open input file '" + Filename + "'!\n";
exit (1);
}
IncludeStack.push_back(IncludeRec(Filename, F));
}
assert(Length >= 2 && "Double quotes not found?");
std::string Filename(Buffer+1, Buffer+Length-1);
- //std::cerr << "Filename = '" << Filename << "'\n";
+ //cerr << "Filename = '" << Filename << "'\n";
// Save the line number and lex buffer of the includer...
IncludeStack.back().LineNo = Filelineno;
class { return CLASS; }
def { return DEF; }
+defm { return DEFM; }
+multiclass { return MULTICLASS; }
field { return FIELD; }
let { return LET; }
in { return IN; }