Skip to content

Commit 62529b4

Browse files
committed
[Support] Do not ignore unterminated open { in formatv
- When an unterminated open { is detected in the format string, instead of asserting and ignoring the error, replace that string with another to indicate the error, and remove the assert as well. - This will make the error behvaior indentical between assert and release builds and also help catch the error more convienent (as several uses of this function are in TableGen and its if often built in release mode even in debug builds, using
1 parent 69f76c7 commit 62529b4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Support/FormatVariadic.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,8 @@ formatv_object_base::splitLiteralAndReplacement(StringRef Fmt) {
112112
// undefined and that we consider it an error.
113113
std::size_t BC = Fmt.find_first_of('}');
114114
if (BC == StringRef::npos) {
115-
assert(
116-
false &&
117-
"Unterminated brace sequence. Escape with {{ for a literal brace.");
118-
return std::make_pair(ReplacementItem{Fmt}, StringRef());
115+
return std::make_pair(ReplacementItem{"Unterminated open {"},
116+
StringRef());
119117
}
120118

121119
// Even if there is a closing brace, if there is another open brace before

0 commit comments

Comments
 (0)