From: Hans Wennborg Date: Mon, 9 Apr 2018 12:21:12 +0000 (+0000) Subject: Try to fix libclang reproducer tests after r329465 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e91fcbae7e0168a178135295b28a5f58c345ce40;p=clang Try to fix libclang reproducer tests after r329465 They were failing on Windows because the output YAML didn't parse: YAML:1:664: error: Unrecognized escape code! {"toolchain":"D:\\buildslave\\clang-x64-ninja-win7\\stage1", "libclang.operation":"complete", "libclang.opts":1, "args":["clang", "-fno-spell-checking", "D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c", "-Xclang", "-detailed-preprocessing-record", "-fallow-editor-placeholders"], "invocation-args":["-code-completion-at=D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c:10:1"], "unsaved_file_hashes":[{"name":"D:\\buildslave\\clang-x64-ninja-win7\\llvm\\tools\\clang\\test\\Index\\create-libclang-completion-reproducer.c", "md5":"aee23773de90e665992b48209351d70e"}]} This adds some more escaping to try to make it work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329558 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndexer.cpp b/tools/libclang/CIndexer.cpp index d902470e6a..30054ea9f7 100644 --- a/tools/libclang/CIndexer.cpp +++ b/tools/libclang/CIndexer.cpp @@ -127,14 +127,14 @@ LibclangInvocationReporter::LibclangInvocationReporter( for (const auto &I : llvm::enumerate(Args)) { if (I.index()) OS << ','; - OS << '"' << I.value() << '"'; + OS << '"' << llvm::yaml::escape(I.value()) << '"'; } if (!InvocationArgs.empty()) { OS << R"(],"invocation-args":[)"; for (const auto &I : llvm::enumerate(InvocationArgs)) { if (I.index()) OS << ','; - OS << '"' << I.value() << '"'; + OS << '"' << llvm::yaml::escape(I.value()) << '"'; } } if (!UnsavedFiles.empty()) {