================
@@ -1391,6 +1421,12 @@ void TextDiagnostic::emitSnippetAndCaret(
       OS.indent(MaxLineNoDisplayWidth + 2) << "| ";
   };
 
+  Columns MessageLength = DiagOpts.MessageLength;
+
+  // If we don't have enough columns available, just abort now.
+  if (MessageLength != 0 && MessageLength <= Columns(MaxLineNoDisplayWidth + 
4))
+    return;
----------------
Sirraide wrote:

```suggestion
  Columns MessageLength = DiagOpts.MessageLength;
  if (MessageLength != 0)
    MessageLength = std::max(MessageLength, Columns(40));
```
I think it makes more sense to clamp `MessageLength` to some minimum value, 
e.g. `20` or `40`. Because if someone seriously passes e.g. 
`-fmessage-length=5`, I candidly have no idea what they’re expecting us to do 
with that.

https://github.com/llvm/llvm-project/pull/164941
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to