You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Parse the assert configuration identifier.if (constArg *A = Args.getLastArg(OPT_AssertConfig)) {
StringRefConfiguration = A->getValue();
if (Configuration == "DisableReplacement") {
Opts.AssertConfig = SILOptions::DisableReplacement;
} elseif (Configuration == "Debug") {
Opts.AssertConfig = SILOptions::Debug;
} elseif (Configuration == "Release") {
Opts.AssertConfig = SILOptions::Release;
} elseif (Configuration == "Unchecked") {
Opts.AssertConfig = SILOptions::Unchecked;
} else {
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
returntrue;
}
} elseif (FEOpts.ParseStdlib) {
// Disable assertion configuration replacement when we build the standard// library.Opts.AssertConfig = SILOptions::DisableReplacement;
} elseif (Opts.AssertConfig == SILOptions::Debug) {
// Set the assert configuration according to the optimization level if it// has not been set by the -Ounchecked flag.Opts.AssertConfig =
(IRGenOpts.shouldOptimize() ? SILOptions::Release : SILOptions::Debug);
}
To summarise, there are three flags that control assert_configuration: -O, -assert-config and -parse-stdlib. I'd argue that the special handling that stdlib receives should extend to Foundation too.
Attachment: Download
Additional Detail from JIRA
md5: d033feae658f0a47f72a9c6f6189edef
Issue Description:
Most projects in the swift build respect
assertions
option passed tobuild-script
:https://github.com/apple/swift/blob/master/utils/build_swift/driver_arguments.py#L606-L662
corelibs-foundation does not.
One of the effects is that
fatalError
-s in Foundation don't contain stack-traces, making them more difficult to diagnose.I'm attaching an example reproduction in the form of SwiftPM package:
In comparison
fatalError
in the executable itself (build in Debug mode, which enables assertions) gives:Which can be symbolicated as follows:
The text was updated successfully, but these errors were encountered: