[PATCH] D60995: [clangd] Make sure include path does not contain any backslashes on Windows

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 00:01:19 PDT 2019

kadircet created this revision.
kadircet added a reviewer: sammccall.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
kadircet added a child revision: D60873: [clang][HeaderSuggestion] Handle the case of dotdot with an absolute path.

  rG LLVM Github Monorepo



Index: clang-tools-extra/clangd/Headers.cpp
--- clang-tools-extra/clangd/Headers.cpp
+++ clang-tools-extra/clangd/Headers.cpp
@@ -193,8 +193,10 @@
   bool IsSystem = false;
   if (!HeaderSearchInfo)
     return "\"" + InsertedHeader.File + "\"";
-  std::string Suggested = HeaderSearchInfo->suggestPathToFileForDiagnostics(
-      InsertedHeader.File, BuildDir, &IsSystem);
+  // Suggest path might contain back slashes on windows.
+  std::string Suggested = llvm::sys::path::convert_to_slash(
+      HeaderSearchInfo->suggestPathToFileForDiagnostics(InsertedHeader.File,
+                                                        BuildDir, &IsSystem));
   if (IsSystem)
     Suggested = "<" + Suggested + ">";

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60995.196188.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190423/fdf90c1f/attachment.bin>

More information about the cfe-commits mailing list