Fix C assert calls for newlib (#4351)

This commit is contained in:
Hiroki Noda 2023-04-13 22:42:41 +09:00 committed by GitHub
parent 25dc3fc6eb
commit d001a7cdb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -317,6 +317,14 @@ void DtoCAssert(Module *M, const Loc &loc, LLValue *msg) {
args.push_back(file);
args.push_back(line);
args.push_back(msg);
} else if (global.params.isNewlibEnvironment) {
const auto irFunc = gIR->func();
const auto funcName =
irFunc && irFunc->decl ? irFunc->decl->toPrettyChars() : "";
args.push_back(file);
args.push_back(line);
args.push_back(DtoConstCString(funcName));
args.push_back(msg);
} else {
args.push_back(msg);
args.push_back(file);