[Support] Harded JSON against invalid UTF-8.
authorSam McCall <sam.mccall@gmail.com>
Tue, 10 Jul 2018 11:51:26 +0000 (11:51 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 10 Jul 2018 11:51:26 +0000 (11:51 +0000)
commite6057bc689f380c245512b6809c3767d964407ed
treee0f7d83dc3c4a456ffe3a0376f85b741779465ae
parentce5c19b623bc677c6e2eb0f7ab21c128e000a982
[Support] Harded JSON against invalid UTF-8.

Parsing invalid UTF-8 input is now a parse error.
Creating JSON values from invalid UTF-8 now triggers an assertion, and
(in no-assert builds) substitutes the unicode replacement character.
Strings retrieved from json::Value are always valid UTF-8.

llvm-svn: 336657
llvm/include/llvm/ADT/StringExtras.h
llvm/include/llvm/Support/JSON.h
llvm/lib/Support/JSON.cpp
llvm/unittests/Support/JSONTest.cpp