diff options
Diffstat (limited to 'tools/libclang/CIndexer.cpp')
| -rw-r--r-- | tools/libclang/CIndexer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/libclang/CIndexer.cpp b/tools/libclang/CIndexer.cpp index 62ea88172069..3c6e1530f198 100644 --- a/tools/libclang/CIndexer.cpp +++ b/tools/libclang/CIndexer.cpp @@ -17,20 +17,20 @@ #include "clang/Basic/Version.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" -#include "llvm/Config/llvm-config.h" #include "llvm/Support/MD5.h" #include "llvm/Support/MutexGuard.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" +#include "llvm/Support/YAMLParser.h" #include <cstdio> #ifdef __CYGWIN__ #include <cygwin/version.h> #include <sys/cygwin.h> -#define LLVM_ON_WIN32 1 +#define _WIN32 1 #endif -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 #include <windows.h> #else #include <dlfcn.h> @@ -46,7 +46,7 @@ const std::string &CIndexer::getClangResourcesPath() { SmallString<128> LibClangPath; // Find the location where this library lives (libclang.dylib). -#ifdef LLVM_ON_WIN32 +#ifdef _WIN32 MEMORY_BASIC_INFORMATION mbi; char path[MAX_PATH]; VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi, @@ -112,7 +112,7 @@ LibclangInvocationReporter::LibclangInvocationReporter( // Write out the information about the invocation to it. auto WriteStringKey = [&OS](StringRef Key, StringRef Value) { OS << R"(")" << Key << R"(":")"; - OS << Value << '"'; + OS << llvm::yaml::escape(Value) << '"'; }; OS << '{'; WriteStringKey("toolchain", Idx.getClangToolchainPath()); @@ -126,14 +126,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()) { |
