[cfe-dev] Highlighting bad encodings?

Seth Cantrell seth.cantrell at gmail.com
Sun Oct 28 00:13:37 PDT 2012


While fixing a small issue with range highlighting of invalid character encodings in string literals I wondered about the desirability if highlighting _every_ invalid character encoding in a string literal rather than simply the first one. Is there any reason to prefer only highlighting the first one?

The result would be something like this:

wrong-encoding.c:28:6: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
  "xx<E9><BF><E9><BF>d";
     ^~~~~~~~
wrong-encoding.c:28:8: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
  "xx<E9><BF><E9><BF>d";
             ^~~~~~~~

Attached is a patch that highlights all the invalid characters, but if possible I'd like them all to be highlighted in a single diagnostic. Is it possible to apply multiple ranges to one diagnostic in this case?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-improve-highlighting-of-invalid-string-encodings.patch
Type: application/octet-stream
Size: 4385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121028/8fae6bc5/attachment.obj>


More information about the cfe-dev mailing list