[clang-tools-extra] r366320 - [clangd] Handle windows line endings in QueryDriver
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 06:14:02 PDT 2019
Author: kadircet
Date: Wed Jul 17 06:14:02 2019
New Revision: 366320
URL: http://llvm.org/viewvc/llvm-project?rev=366320&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
clang-tools-extra/trunk/clangd/test/system-include-extractor.test
Modified: clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp?rev=366320&r1=366319&r2=366320&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp (original)
+++ clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp Wed Jul 17 06:14:02 2019
@@ -63,7 +63,9 @@ std::vector<std::string> parseDriverOutp
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 {};
Modified: clang-tools-extra/trunk/clangd/test/system-include-extractor.test
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/test/system-include-extractor.test?rev=366320&r1=366319&r2=366320&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/test/system-include-extractor.test (original)
+++ clang-tools-extra/trunk/clangd/test/system-include-extractor.test Wed Jul 17 06:14:02 2019
@@ -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
More information about the cfe-commits
mailing list