[clangd] Handle windows line endings in QueryDriver

Summary: fixes second case of https://github.com/clangd/clangd/issues/93

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64789

llvm-svn: 366320
This commit is contained in:
Kadir Cetinkaya 2019-07-17 13:14:02 +00:00
parent 0257c6b659
commit 6011a285ed
2 changed files with 4 additions and 2 deletions

View File

@ -63,7 +63,9 @@ std::vector<std::string> parseDriverOutput(llvm::StringRef Output) {
llvm::SmallVector<llvm::StringRef, 8> Lines;
Output.split(Lines, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
auto StartIt = std::find(Lines.begin(), Lines.end(), SIS);
auto StartIt =
std::find_if(Lines.begin(), Lines.end(),
[](llvm::StringRef Line) { return Line.trim() == SIS; });
if (StartIt == Lines.end()) {
elog("System include extraction: start marker not found: {0}", Output);
return {};

View File

@ -5,7 +5,7 @@
# RUN: echo '#!/bin/bash' >> %t.dir/my_driver.sh
# RUN: echo '[ "$0" = "%t.dir/my_driver.sh" ] || exit' >> %t.dir/my_driver.sh
# RUN: echo 'echo line to ignore >&2' >> %t.dir/my_driver.sh
# RUN: echo 'echo \#include \<...\> search starts here: >&2' >> %t.dir/my_driver.sh
# 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