mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[di] Add a debugging option to trigger an unreachable when DI fails instead of continuing.
This enables one to easily stop in the debugger when one hits a DI error.
This commit is contained in:
@@ -35,11 +35,19 @@
|
||||
using namespace swift;
|
||||
using namespace ownership;
|
||||
|
||||
llvm::cl::opt<bool> TriggerUnreachableOnFailure(
|
||||
"sil-di-assert-on-failure", llvm::cl::init(false),
|
||||
llvm::cl::desc("After emitting a DI error, assert instead of continuing. "
|
||||
"Meant for debugging ONLY!"),
|
||||
llvm::cl::Hidden);
|
||||
|
||||
STATISTIC(NumAssignRewritten, "Number of assigns rewritten");
|
||||
|
||||
template<typename ...ArgTypes>
|
||||
static void diagnose(SILModule &M, SILLocation loc, ArgTypes... args) {
|
||||
M.getASTContext().Diags.diagnose(loc.getSourceLoc(), Diagnostic(args...));
|
||||
if (TriggerUnreachableOnFailure)
|
||||
llvm_unreachable("Triggering standard assertion failure routine");
|
||||
}
|
||||
|
||||
enum class PartialInitializationKind {
|
||||
|
||||
Reference in New Issue
Block a user