rsmith added a comment.

This would violate our guidelines for diagnostic messages; see 
https://clang.llvm.org/docs/InternalsManual.html#the-format-string

In particular: "Take advantage of location information. The user will be able 
to see the line and location of the caret, so you don’t need to tell them that 
the problem is with the 4th argument to the function: just point to it."

> Reasons why printing assert expression in absence of string literal is useful 
> are:
> 
> 1. Serialized diagnostics (--serialize-diagnostics) don't contain code 
> snippet and thus error message lack context.
> 2. Not all tools scraping clang diagnostics use caret snippet provided by 
> -fcaret-diagnostics.

This seems like an excellent reason to fix those tools -- per our 
documentation, Clang's diagnostics are not designed to be used without the 
caret and snippet.

If you want to change our diagnostic policy from "the diagnostic text plus the 
line and location of the caret should be enough to identify the problem; do not 
repeat information in the diagnostic that the caret portion shows" to "the 
diagnostic text alone should be sufficient", that's certainly something we can 
discuss, but you'll need to make the case for why that's a good change of 
policy.


Repository:
  rC Clang

https://reviews.llvm.org/D46834



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D46834: [... Jan Korous via Phabricator via cfe-commits
    • [PATCH] D468... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D468... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D468... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D468... Jan Korous via Phabricator via cfe-commits
    • [PATCH] D468... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D468... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D468... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D468... Duncan P. N. Exon Smith via Phabricator via cfe-commits

Reply via email to