Mark abort builtin as noreturn.
This commit is contained in:
parent
7cc72828a0
commit
7338102d46
|
@ -168,7 +168,9 @@ llvm::Value* NestedScopes::lookup(const std::string& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRGenerator::declareBuiltins() {
|
void IRGenerator::declareBuiltins() {
|
||||||
module_->getOrInsertFunction("abort", llvm::FunctionType::get(builder_.getVoidTy(), false));
|
llvm::FunctionType* abort_type = llvm::FunctionType::get(builder_.getVoidTy(), false);
|
||||||
|
auto no_return = llvm::AttributeList().addAttribute(context_, 1, llvm::Attribute::NoReturn);
|
||||||
|
module_->getOrInsertFunction("abort", abort_type, no_return);
|
||||||
|
|
||||||
llvm::FunctionType* printf_type =
|
llvm::FunctionType* printf_type =
|
||||||
llvm::FunctionType::get(builder_.getInt32Ty(), {builder_.getInt8PtrTy()}, true);
|
llvm::FunctionType::get(builder_.getInt32Ty(), {builder_.getInt8PtrTy()}, true);
|
||||||
|
@ -335,8 +337,8 @@ llvm::Value* IRGenerator::evalBooleanCondition(const Expression* condition_expre
|
||||||
auto condition_type = condition->getType();
|
auto condition_type = condition->getType();
|
||||||
condition = evalTruthiness(condition);
|
condition = evalTruthiness(condition);
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
error(condition_expression, "cannot convert expression of type",
|
error(condition_expression, "cannot convert expression of type", getSourceType(condition_type),
|
||||||
getSourceType(condition_type), "to boolean.");
|
"to boolean.");
|
||||||
}
|
}
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user