Fix the generated errors in tbl-srn

This commit is contained in:
Sameer Rahmani 2022-01-28 11:46:40 +00:00
parent 935634b7c8
commit 51a412d56d
3 changed files with 6 additions and 5 deletions

View File

@ -37,8 +37,8 @@ public:
void log(llvm::raw_ostream &os) const { os << msg; };
std::string message() const override { return msg; };
std::string &getTitle() const override { return T::title; };
std::string &getDesc() const override { return T::description; };
std::string &getTitle() const { return T::title; };
std::string &getDesc() const { return T::description; };
std::error_code convertToErrorCode() const { return std::error_code(); };
SereneError(reader::LocationRange &loc, std::string &msg)

View File

@ -20,6 +20,7 @@
#define SERENE_ERRORS_ERROR_H
#include "serene/errors/constants.h"
#include "serene/errors/errs.h.inc"
#include "serene/errors/traits.h"
#include "serene/reader/traits.h"
#include "serene/traits.h"

View File

@ -60,7 +60,7 @@ void ErrorsBackend::createErrorClass(const int id, llvm::Record &defRec,
os << "class " << recName << " : public SereneError<" << recName << "> {\n"
<< "public:\n"
<< " static int ID = " << id << ";\n";
<< " static const int ID = " << id << ";\n";
for (const auto &val : defRec.getValues()) {
auto valName = val.getName();
@ -85,7 +85,7 @@ void ErrorsBackend::createErrorClass(const int id, llvm::Record &defRec,
continue;
}
os << " static std::string " << valName << " = ";
os << " inline static const std::string " << valName << " = ";
const llvm::MemoryBufferRef value(stringVal->getValue(), valName);
llvm::line_iterator lines(value, false);
@ -128,7 +128,7 @@ void ErrorsBackend::run(llvm::raw_ostream &os) {
(void)records;
llvm::emitSourceFileHeader("Serene's Errors collection", os);
os << "#inlude \"serene/errors/base.h\"\n\n#include "
os << "#include \"serene/errors/base.h\"\n\n#include "
"<llvm/Support/Error.h>\n\n";
inNamespace("serene::errors", os,