mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
-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:
parent
fbbbeecaca
commit
30b858781b
10 changed files with 106 additions and 32 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue