[clang-tools-extra] r359112 - [clangd] Fix broken helper deep in unit test. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 24 10:00:38 PDT 2019
Author: sammccall
Date: Wed Apr 24 10:00:38 2019
New Revision: 359112
URL: http://llvm.org/viewvc/llvm-project?rev=359112&view=rev
Log:
[clangd] Fix broken helper deep in unit test. NFC
Modified:
clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp?rev=359112&r1=359111&r2=359112&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp Wed Apr 24 10:00:38 2019
@@ -29,15 +29,9 @@ Symbol symbol(llvm::StringRef QName) {
static std::string replace(llvm::StringRef Haystack, llvm::StringRef Needle,
llvm::StringRef Repl) {
- std::string Result;
- llvm::raw_string_ostream OS(Result);
- std::pair<llvm::StringRef, llvm::StringRef> Split;
- for (Split = Haystack.split(Needle); !Split.second.empty();
- Split = Split.first.split(Needle))
- OS << Split.first << Repl;
- Result += Split.first;
- OS.flush();
- return Result;
+ llvm::SmallVector<llvm::StringRef, 8> Parts;
+ Haystack.split(Parts, Needle);
+ return llvm::join(Parts, Repl);
}
// Helpers to produce fake index symbols for memIndex() or completions().
More information about the cfe-commits
mailing list