[PATCH] D64970: [clangd] Handle windows line endings in QueryDriver

Kadir Cetinkaya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 02:11:12 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366545: [clangd] Handle windows line endings in QueryDriver (authored by kadircet, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64970?vs=210737&id=210777#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64970/new/

https://reviews.llvm.org/D64970

Files:
  clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
  clang-tools-extra/trunk/clangd/test/system-include-extractor.test


Index: clang-tools-extra/trunk/clangd/test/system-include-extractor.test
===================================================================
--- clang-tools-extra/trunk/clangd/test/system-include-extractor.test
+++ clang-tools-extra/trunk/clangd/test/system-include-extractor.test
@@ -8,7 +8,7 @@
 # RUN: echo 'echo -e "#include <...> search starts here:\r" >&2' >> %t.dir/my_driver.sh
 # RUN: echo 'echo %t.dir/my/dir/ >&2' >> %t.dir/my_driver.sh
 # RUN: echo 'echo %t.dir/my/dir2/ >&2' >> %t.dir/my_driver.sh
-# RUN: echo 'echo End of search list. >&2' >> %t.dir/my_driver.sh
+# RUN: echo 'echo -e "End of search list.\r" >&2' >> %t.dir/my_driver.sh
 # RUN: chmod +x %t.dir/my_driver.sh
 
 # Create header files my/dir/a.h and my/dir2/b.h
Index: clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
+++ clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
@@ -59,7 +59,7 @@
 std::vector<std::string> parseDriverOutput(llvm::StringRef Output) {
   std::vector<std::string> SystemIncludes;
   const char SIS[] = "#include <...> search starts here:";
-  constexpr char const *SIE = "End of search list.";
+  const char SIE[] = "End of search list.";
   llvm::SmallVector<llvm::StringRef, 8> Lines;
   Output.split(Lines, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
 
@@ -70,7 +70,9 @@
     return {};
   }
   ++StartIt;
-  const auto EndIt = std::find(StartIt, Lines.end(), SIE);
+  const auto EndIt =
+      llvm::find_if(llvm::make_range(StartIt, Lines.end()),
+                    [SIE](llvm::StringRef Line) { return Line.trim() == SIE; });
   if (EndIt == Lines.end()) {
     elog("System include extraction: end marker missing: {0}", Output);
     return {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64970.210777.patch
Type: text/x-patch
Size: 1796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190719/ee611aee/attachment.bin>


More information about the llvm-commits mailing list