lh123 created this revision. lh123 added reviewers: sammccall, kadircet. lh123 added a project: clang-tools-extra. Herald added subscribers: cfe-commits, arphaman, jkorous, ilya-biryukov. Herald added a project: clang.
The previous patch did not fix the end mark. D64789 <https://reviews.llvm.org/D64789> fixes second case of https://github.com/clangd/clangd/issues/93 Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D64970 Files: clang-tools-extra/clangd/QueryDriverDatabase.cpp Index: clang-tools-extra/clangd/QueryDriverDatabase.cpp =================================================================== --- clang-tools-extra/clangd/QueryDriverDatabase.cpp +++ clang-tools-extra/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 {};
Index: clang-tools-extra/clangd/QueryDriverDatabase.cpp =================================================================== --- clang-tools-extra/clangd/QueryDriverDatabase.cpp +++ clang-tools-extra/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 {};
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits