mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[frontend] Added a handful of options to force the frontend to assert or crash.
Added -debug-assert-immediately and -debug-crash-immediately, which cause an llvm_unreachable or LLVM_BUILTIN_TRAP to execute during argument parsing. Added -debug-assert-after-parse and -debug-crash-after-parse, which cause an llvm_unreachable or LLVM_BUILTIN_TRAP to execute after calling CompilerInstance::performParse(). This fixes <rdar://problem/16013025>. Swift SVN r13653
This commit is contained in:
@@ -65,6 +65,23 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||
DiagnosticEngine &Diags) {
|
||||
using namespace options;
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_debug_crash_Group)) {
|
||||
Option Opt = A->getOption();
|
||||
if (Opt.matches(OPT_debug_assert_immediately)) {
|
||||
llvm_unreachable("This is an assertion!");
|
||||
} else if (Opt.matches(OPT_debug_crash_immediately)) {
|
||||
LLVM_BUILTIN_TRAP;
|
||||
} else if (Opt.matches(OPT_debug_assert_after_parse)) {
|
||||
// Set in FrontendOptions
|
||||
Opts.CrashMode = FrontendOptions::DebugCrashMode::AssertAfterParse;
|
||||
} else if (Opt.matches(OPT_debug_crash_after_parse)) {
|
||||
// Set in FrontendOptions
|
||||
Opts.CrashMode = FrontendOptions::DebugCrashMode::CrashAfterParse;
|
||||
} else {
|
||||
llvm_unreachable("Unknown debug_crash_Group option!");
|
||||
}
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_emit_verbose_sil)) {
|
||||
Opts.EmitVerboseSIL = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user