Skip to content

Commit 1e15a85

Browse files
committed
Add comment for cond-fail-config-file option
1 parent 2f30161 commit 1e15a85

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/SILOptimizer/SILCombiner/SILCombine.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,27 @@ void SwiftPassInvocation::eraseInstruction(SILInstruction *inst) {
707707
}
708708
}
709709

710+
// The standard library uses _precondition calls which have a message argument.
711+
//
712+
// Allow disabling the generated cond_fail by these message arguments.
713+
//
714+
// For example:
715+
//
716+
// _precondition(source >= (0 as T), "Negative value is not representable")
717+
// results in a cond_fail "Negative value is not representable".
718+
//
719+
// This commit allows for specifying a file that contains these messages on each
720+
// line.
721+
//
722+
// /path/to/disable_cond_fails:
723+
//
724+
// ```
725+
// Negative value is not representable
726+
// Array index is out of range
727+
// ```
728+
//
729+
// The optimizer will remove these cond_fails if the swift frontend is invoked
730+
// with -Xllvm -cond-fail-config-file=/path/to/disable_cond_fails.
710731
static llvm::cl::opt<std::string> CondFailConfigFile(
711732
"cond-fail-config-file", llvm::cl::init(""),
712733
llvm::cl::desc("read the cond_fail message strings to elimimate from file"));

0 commit comments

Comments
 (0)