Fix all the tidy issues
This commit is contained in:
parent
55e0788bae
commit
fd66e47cd7
|
@ -42,7 +42,7 @@ namespace serene {
|
||||||
|
|
||||||
namespace reader {
|
namespace reader {
|
||||||
class LocationRange;
|
class LocationRange;
|
||||||
}
|
} // namespace reader
|
||||||
|
|
||||||
namespace exprs {
|
namespace exprs {
|
||||||
class Expression;
|
class Expression;
|
||||||
|
|
|
@ -20,8 +20,10 @@
|
||||||
#define SERENE_ERRORS_CONSTANTS_H
|
#define SERENE_ERRORS_CONSTANTS_H
|
||||||
|
|
||||||
#include <llvm/Support/FormatVariadic.h>
|
#include <llvm/Support/FormatVariadic.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace serene {
|
namespace serene {
|
||||||
namespace errors {
|
namespace errors {
|
||||||
|
@ -50,7 +52,8 @@ struct ErrorVariant {
|
||||||
std::string longDescription;
|
std::string longDescription;
|
||||||
|
|
||||||
ErrorVariant(ErrID id, std::string desc, std::string longDesc)
|
ErrorVariant(ErrID id, std::string desc, std::string longDesc)
|
||||||
: id(id), description(desc), longDescription(longDesc){};
|
: id(id), description(std::move(desc)),
|
||||||
|
longDescription(std::move(longDesc)){};
|
||||||
|
|
||||||
std::string getErrId() { return llvm::formatv("E{0:d}", id); };
|
std::string getErrId() { return llvm::formatv("E{0:d}", id); };
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ERRORS_TRAITS_H
|
#ifndef SERENE_ERRORS_TRAITS_H
|
||||||
#define ERRORS_TRAITS_H
|
#define SERENE_ERRORS_TRAITS_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/constants.h"
|
#include "serene/errors/constants.h"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_CALL_H
|
#ifndef SERENE_EXPRS_CALL_H
|
||||||
#define EXPRS_CALL_H
|
#define SERENE_EXPRS_CALL_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/error.h"
|
#include "serene/errors/error.h"
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
#include <llvm/Support/Error.h>
|
#include <llvm/Support/Error.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -49,8 +50,9 @@ public:
|
||||||
|
|
||||||
ExprType getType() const override;
|
ExprType getType() const override;
|
||||||
std::string toString() const override;
|
std::string toString() const override;
|
||||||
MaybeNode analyze(SereneContext &) override;
|
MaybeNode analyze(SereneContext & /*ctx*/) override;
|
||||||
void generateIR(serene::Namespace &, mlir::ModuleOp &) override{};
|
void generateIR(serene::Namespace & /*ns*/,
|
||||||
|
mlir::ModuleOp & /*m*/) override{};
|
||||||
|
|
||||||
static bool classof(const Expression *e);
|
static bool classof(const Expression *e);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_DEF_H
|
#ifndef SERENE_EXPRS_DEF_H
|
||||||
#define EXPRS_DEF_H
|
#define SERENE_EXPRS_DEF_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/error.h"
|
#include "serene/errors/error.h"
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
#include <llvm/Support/Error.h>
|
#include <llvm/Support/Error.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -48,8 +49,8 @@ public:
|
||||||
|
|
||||||
ExprType getType() const override;
|
ExprType getType() const override;
|
||||||
std::string toString() const override;
|
std::string toString() const override;
|
||||||
MaybeNode analyze(SereneContext &) override;
|
MaybeNode analyze(SereneContext & /*ctx*/) override;
|
||||||
void generateIR(serene::Namespace &, mlir::ModuleOp &) override;
|
void generateIR(serene::Namespace & /*ns*/, mlir::ModuleOp & /*m*/) override;
|
||||||
|
|
||||||
static bool classof(const Expression *e);
|
static bool classof(const Expression *e);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_EXPRESSION_H
|
#ifndef SERENE_EXPRS_EXPRESSION_H
|
||||||
#define EXPRS_EXPRESSION_H
|
#define SERENE_EXPRS_EXPRESSION_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/error.h"
|
#include "serene/errors/error.h"
|
||||||
|
@ -25,9 +25,10 @@
|
||||||
#include "serene/reader/location.h"
|
#include "serene/reader/location.h"
|
||||||
#include "serene/utils.h"
|
#include "serene/utils.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <mlir/IR/BuiltinOps.h>
|
#include <mlir/IR/BuiltinOps.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace serene {
|
namespace serene {
|
||||||
|
|
||||||
/// Contains all the builtin AST expressions including those which do not appear
|
/// Contains all the builtin AST expressions including those which do not appear
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_FN_H
|
#ifndef SERENE_EXPRS_FN_H
|
||||||
#define EXPRS_FN_H
|
#define SERENE_EXPRS_FN_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/error.h"
|
#include "serene/errors/error.h"
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
#include <llvm/Support/Error.h>
|
#include <llvm/Support/Error.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -52,8 +53,8 @@ public:
|
||||||
|
|
||||||
ExprType getType() const override;
|
ExprType getType() const override;
|
||||||
std::string toString() const override;
|
std::string toString() const override;
|
||||||
MaybeNode analyze(SereneContext &) override;
|
MaybeNode analyze(SereneContext & /*ctx*/) override;
|
||||||
void generateIR(serene::Namespace &, mlir::ModuleOp &) override;
|
void generateIR(serene::Namespace & /*ns*/, mlir::ModuleOp & /*m*/) override;
|
||||||
|
|
||||||
static bool classof(const Expression *e);
|
static bool classof(const Expression *e);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_LIST_H
|
#ifndef SERENE_EXPRS_LIST_H
|
||||||
#define EXPRS_LIST_H
|
#define SERENE_EXPRS_LIST_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/exprs/expression.h"
|
#include "serene/exprs/expression.h"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_NUMBER_H
|
#ifndef SERENE_EXPRS_NUMBER_H
|
||||||
#define EXPRS_NUMBER_H
|
#define SERENE_EXPRS_NUMBER_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/exprs/expression.h"
|
#include "serene/exprs/expression.h"
|
||||||
|
@ -48,7 +48,7 @@ struct Number : public Expression {
|
||||||
std::string toString() const override;
|
std::string toString() const override;
|
||||||
|
|
||||||
MaybeNode analyze(SereneContext &ctx) override;
|
MaybeNode analyze(SereneContext &ctx) override;
|
||||||
void generateIR(serene::Namespace &, mlir::ModuleOp &) override;
|
void generateIR(serene::Namespace & /*ns*/, mlir::ModuleOp & /*m*/) override;
|
||||||
|
|
||||||
// TODO: This is horrible, we need to fix it after the mvp
|
// TODO: This is horrible, we need to fix it after the mvp
|
||||||
int toI64() const;
|
int toI64() const;
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_SYMBOL_H
|
#ifndef SERENE_EXPRS_SYMBOL_H
|
||||||
#define EXPRS_SYMBOL_H
|
#define SERENE_EXPRS_SYMBOL_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/exprs/expression.h"
|
#include "serene/exprs/expression.h"
|
||||||
|
|
||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace serene {
|
namespace serene {
|
||||||
|
@ -44,8 +45,9 @@ public:
|
||||||
ExprType getType() const override;
|
ExprType getType() const override;
|
||||||
std::string toString() const override;
|
std::string toString() const override;
|
||||||
|
|
||||||
MaybeNode analyze(SereneContext &) override;
|
MaybeNode analyze(SereneContext & /*ctx*/) override;
|
||||||
void generateIR(serene::Namespace &, mlir::ModuleOp &) override{};
|
void generateIR(serene::Namespace & /*ns*/,
|
||||||
|
mlir::ModuleOp & /*m*/) override{};
|
||||||
|
|
||||||
~Symbol() = default;
|
~Symbol() = default;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EXPRS_TRAITS_H
|
#ifndef SERENE_EXPRS_TRAITS_H
|
||||||
#define EXPRS_TRAITS_H
|
#define SERENE_EXPRS_TRAITS_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/reader/location.h"
|
#include "serene/reader/location.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef SERENE_LLVM_VALUE_H
|
#ifndef LLVM_IR_VALUE_H
|
||||||
#define SERENE_LLVM_VALUE_H
|
#define LLVM_IR_VALUE_H
|
||||||
|
|
||||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||||
#include <llvm/IR/Value.h>
|
#include <llvm/IR/Value.h>
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SERENE_LLVM_PATCHES_H
|
#ifndef LLVM_PATCHES_H
|
||||||
#define SERENE_LLVM_PATCHES_H
|
#define LLVM_PATCHES_H
|
||||||
|
|
||||||
#include <llvm/ADT/DenseMap.h>
|
#include <llvm/ADT/DenseMap.h>
|
||||||
|
|
||||||
|
@ -34,17 +34,19 @@ struct DenseMapInfo<std::string> {
|
||||||
return "0TOMBED";
|
return "0TOMBED";
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned getHashValue(std::string Val) {
|
static unsigned getHashValue(const std::string &Val) {
|
||||||
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
|
assert(Val != getEmptyKey() && "Cannot hash the empty key!");
|
||||||
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
|
assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
|
||||||
return (unsigned)(llvm::hash_value(Val));
|
return (unsigned)(llvm::hash_value(Val));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isEqual(std::string LHS, std::string RHS) {
|
static bool isEqual(const std::string &LHS, const std::string &RHS) {
|
||||||
if (RHS == getEmptyKey())
|
if (RHS == getEmptyKey()) {
|
||||||
return LHS == getEmptyKey();
|
return LHS == getEmptyKey();
|
||||||
if (RHS == getTombstoneKey())
|
}
|
||||||
|
if (RHS == getTombstoneKey()) {
|
||||||
return LHS == getTombstoneKey();
|
return LHS == getTombstoneKey();
|
||||||
|
}
|
||||||
return LHS == RHS;
|
return LHS == RHS;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,17 +34,18 @@
|
||||||
#include "serene/traits.h"
|
#include "serene/traits.h"
|
||||||
#include "serene/utils.h"
|
#include "serene/utils.h"
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <llvm/ADT/SmallString.h>
|
#include <llvm/ADT/SmallString.h>
|
||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
#include <llvm/ADT/Twine.h>
|
#include <llvm/ADT/Twine.h>
|
||||||
#include <llvm/IR/Module.h>
|
#include <llvm/IR/Module.h>
|
||||||
#include <memory>
|
|
||||||
#include <mlir/IR/Builders.h>
|
#include <mlir/IR/Builders.h>
|
||||||
#include <mlir/IR/BuiltinOps.h>
|
#include <mlir/IR/BuiltinOps.h>
|
||||||
#include <mlir/IR/OwningOpRef.h>
|
#include <mlir/IR/OwningOpRef.h>
|
||||||
#include <mlir/IR/Value.h>
|
#include <mlir/IR/Value.h>
|
||||||
#include <mlir/Support/LogicalResult.h>
|
#include <mlir/Support/LogicalResult.h>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define NAMESPACE_LOG(...) \
|
#define NAMESPACE_LOG(...) \
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SERENE_LOCATION_H
|
#ifndef SERENE_READER_LOCATION_H
|
||||||
#define SERENE_LOCATION_H
|
#define SERENE_READER_LOCATION_H
|
||||||
|
|
||||||
#include <mlir/IR/Diagnostics.h>
|
#include <mlir/IR/Diagnostics.h>
|
||||||
#include <mlir/IR/Location.h>
|
#include <mlir/IR/Location.h>
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
LocationRange(Location _start, Location _end) : start(_start), end(_end){};
|
LocationRange(Location _start, Location _end) : start(_start), end(_end){};
|
||||||
// LocationRange(const LocationRange &);
|
// LocationRange(const LocationRange &);
|
||||||
|
|
||||||
bool isKnownLocation() { return start.knownLocation; };
|
bool isKnownLocation() const { return start.knownLocation; };
|
||||||
|
|
||||||
static LocationRange UnknownLocation(llvm::StringRef ns) {
|
static LocationRange UnknownLocation(llvm::StringRef ns) {
|
||||||
return LocationRange(Location::UnknownLocation(ns));
|
return LocationRange(Location::UnknownLocation(ns));
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef READER_H
|
#ifndef SERENE_READER_READER_H
|
||||||
#define READER_H
|
#define SERENE_READER_READER_H
|
||||||
|
|
||||||
#include "serene/errors.h"
|
#include "serene/errors.h"
|
||||||
#include "serene/exprs/expression.h"
|
#include "serene/exprs/expression.h"
|
||||||
|
@ -121,10 +121,10 @@ public:
|
||||||
|
|
||||||
/// Parses the given `input` string and returns a `Result<ast>`
|
/// Parses the given `input` string and returns a `Result<ast>`
|
||||||
/// which may contains an AST or an `llvm::Error`
|
/// which may contains an AST or an `llvm::Error`
|
||||||
Result<exprs::Ast> read(SereneContext &ctx, const llvm::StringRef input,
|
Result<exprs::Ast> read(SereneContext &ctx, llvm::StringRef input,
|
||||||
llvm::StringRef ns,
|
llvm::StringRef ns,
|
||||||
llvm::Optional<llvm::StringRef> filename);
|
llvm::Optional<llvm::StringRef> filename);
|
||||||
Result<exprs::Ast> read(SereneContext &ctx, const llvm::MemoryBufferRef input,
|
Result<exprs::Ast> read(SereneContext &ctx, llvm::MemoryBufferRef input,
|
||||||
llvm::StringRef ns,
|
llvm::StringRef ns,
|
||||||
llvm::Optional<llvm::StringRef> filename);
|
llvm::Optional<llvm::StringRef> filename);
|
||||||
} // namespace serene::reader
|
} // namespace serene::reader
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef READER_SEMANTICS_H
|
#ifndef SERENE_READER_SEMANTICS_H
|
||||||
#define READER_SEMANTICS_H
|
#define SERENE_READER_SEMANTICS_H
|
||||||
|
|
||||||
#include "serene/context.h"
|
#include "serene/context.h"
|
||||||
#include "serene/errors/error.h"
|
#include "serene/errors/error.h"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef READER_TRAITS_H
|
#ifndef SERENE_READER_TRAITS_H
|
||||||
#define READER_TRAITS_H
|
#define SERENE_READER_TRAITS_H
|
||||||
|
|
||||||
#include "serene/reader/location.h"
|
#include "serene/reader/location.h"
|
||||||
#include "serene/traits.h"
|
#include "serene/traits.h"
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef SERENE_SLIR_DIALECT_H_
|
#ifndef SERENE_SLIR_DIALECT_H
|
||||||
#define SERENE_SLIR_DIALECT_H_
|
#define SERENE_SLIR_DIALECT_H
|
||||||
|
|
||||||
#include <mlir/IR/BuiltinOps.h>
|
#include <mlir/IR/BuiltinOps.h>
|
||||||
#include <mlir/IR/Dialect.h>
|
#include <mlir/IR/Dialect.h>
|
||||||
|
@ -34,4 +34,4 @@
|
||||||
|
|
||||||
#include "serene/slir/ops.h.inc"
|
#include "serene/slir/ops.h.inc"
|
||||||
|
|
||||||
#endif // DIALECT_H_
|
#endif // SERENE_SLIR_DIALECT_H
|
||||||
|
|
|
@ -15,15 +15,16 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef SERENE_SLIR_H
|
#ifndef SERENE_SLIR_SLIR_H
|
||||||
#define SERENE_SLIR_H
|
#define SERENE_SLIR_SLIR_H
|
||||||
|
|
||||||
#include "serene/exprs/expression.h"
|
#include "serene/exprs/expression.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <mlir/IR/BuiltinOps.h>
|
#include <mlir/IR/BuiltinOps.h>
|
||||||
#include <mlir/IR/MLIRContext.h>
|
#include <mlir/IR/MLIRContext.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace serene {
|
namespace serene {
|
||||||
namespace slir {
|
namespace slir {
|
||||||
std::unique_ptr<llvm::Module> compileToLLVMIR(serene::SereneContext &ctx,
|
std::unique_ptr<llvm::Module> compileToLLVMIR(serene::SereneContext &ctx,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
namespace serene {
|
namespace serene {
|
||||||
class Namespace;
|
class Namespace;
|
||||||
}
|
} // namespace serene
|
||||||
|
|
||||||
namespace serene::slir {
|
namespace serene::slir {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TRAITS_LOCATABLE_H
|
#ifndef SERENE_TRAITS_LOCATABLE_H
|
||||||
#define TRAITS_LOCATABLE_H
|
#define SERENE_TRAITS_LOCATABLE_H
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "serene/export.h"
|
#include "serene/export.h"
|
||||||
|
|
||||||
#include <llvm/Support/Error.h>
|
#include <llvm/Support/Error.h>
|
||||||
|
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
// Sometimes we need this to make both analyzer happy
|
// Sometimes we need this to make both analyzer happy
|
||||||
|
@ -92,33 +93,6 @@ public:
|
||||||
bool ok() const { return std::holds_alternative<T>(contents); };
|
bool ok() const { return std::holds_alternative<T>(contents); };
|
||||||
|
|
||||||
operator bool() const { return ok(); }
|
operator bool() const { return ok(); }
|
||||||
|
|
||||||
const T &getValueOrFail(llvm::StringRef msg, int exitCode = 1) const & {
|
|
||||||
if (ok()) {
|
|
||||||
return getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
llvm::errs() << msg << "\n";
|
|
||||||
exit(exitCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
T &getValueOrFail(llvm::StringRef msg, int exitCode = 1) & {
|
|
||||||
if (ok()) {
|
|
||||||
return getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
llvm::errs() << msg << "\n";
|
|
||||||
exit(exitCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
T &&getValueOrFail(llvm::StringRef msg, int exitCode = 1) && {
|
|
||||||
if (ok()) {
|
|
||||||
return std::move(getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
llvm::errs() << msg << "\n";
|
|
||||||
exit(exitCode);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace serene
|
} // namespace serene
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <llvm/Support/raw_ostream.h>
|
#include <llvm/Support/raw_ostream.h>
|
||||||
#include <llvm/Target/TargetMachine.h>
|
#include <llvm/Target/TargetMachine.h>
|
||||||
#include <llvm/Target/TargetOptions.h>
|
#include <llvm/Target/TargetOptions.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
Loading…
Reference in New Issue