-betterC: Use C assert function

Instead of druntime's _d_assert[_msg], _d_arraybounds and
_d_switch_error.

Tested by dmd-testsuite's runnable/cassert and compilable/betterCarray.
This commit is contained in:
Martin 2017-10-13 19:49:24 +02:00
parent fbbbeecaca
commit 30b858781b
10 changed files with 106 additions and 32 deletions

View file

@ -1644,15 +1644,21 @@ public:
stmt->loc.toChars());
LOG_SCOPE;
assert(!irs->dcomputetarget);
auto &PGO = irs->funcGen().pgo;
PGO.setCurrentStmt(stmt);
Module *const module = irs->func()->decl->getModule();
if (global.params.betterC) {
DtoCAssert(module, stmt->loc, DtoConstCString("no switch default"));
return;
}
llvm::Function *fn =
getRuntimeFunction(stmt->loc, irs->module, "_d_switch_error");
LLValue *moduleInfoSymbol =
getIrModule(irs->func()->decl->getModule())->moduleInfoSymbol();
LLValue *moduleInfoSymbol = getIrModule(module)->moduleInfoSymbol();
LLType *moduleInfoType = DtoType(Module::moduleinfo->type);
LLCallSite call = irs->CreateCallOrInvoke(