[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:
Michael Gottesman
2017-04-20 18:03:25 -07:00
parent af8c90e5e6
commit d25328f995

View File

@@ -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 {