[PATCH] D41290: [YAML] Add support for non-printable characters
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 17:34:03 PST 2017
MatzeB added inline comments.
Comment at: llvm/trunk/include/llvm/Support/YAMLTraits.h:552-555
+ // C1 control block (0x80 - 0x9F) is excluded from the allowed character
+ // range.
+ if (C >= 0x80 && C <= 0x9F)
+ return QuotingType::Double;
This part is sketchy. As we are most probably dealing with UTF-8 without having fully parsed code point here. (Not that the code/comments give any indication that we indeed have UTF-8). While for ASCII (= top bit is clear) UTF-8 and ASCII are the same, for other characters (top bit set) it is not.
I think the best/easiest thing to do here is to always trigger double quoting on `(C & 0x80) != 0`
More information about the llvm-commits