Skip to content

Commit 2d014b7

Browse files
committed
[test][clangd] Use StringRef instead of std::string
runWithAST stores the first parameters as StringRef, so we can't use temporarily std::string from parameter ID.
1 parent e07c092 commit 2d014b7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,22 +281,22 @@ TEST_F(TUSchedulerTests, Cancellation) {
281281
// R2B
282282
// U3(WantDiags=Yes)
283283
// R3 <-- cancelled
284-
std::vector<std::string> DiagsSeen, ReadsSeen, ReadsCanceled;
284+
std::vector<StringRef> DiagsSeen, ReadsSeen, ReadsCanceled;
285285
{
286286
Notification Proceed; // Ensure we schedule everything.
287287
TUScheduler S(CDB, optsForTest(), captureDiags());
288288
auto Path = testPath("foo.cpp");
289289
// Helper to schedule a named update and return a function to cancel it.
290-
auto Update = [&](std::string ID) -> Canceler {
290+
auto Update = [&](StringRef ID) -> Canceler {
291291
auto T = cancelableTask();
292292
WithContext C(std::move(T.first));
293293
updateWithDiags(
294-
S, Path, "//" + ID, WantDiagnostics::Yes,
294+
S, Path, ("//" + ID).str(), WantDiagnostics::Yes,
295295
[&, ID](std::vector<Diag> Diags) { DiagsSeen.push_back(ID); });
296296
return std::move(T.second);
297297
};
298298
// Helper to schedule a named read and return a function to cancel it.
299-
auto Read = [&](std::string ID) -> Canceler {
299+
auto Read = [&](StringRef ID) -> Canceler {
300300
auto T = cancelableTask();
301301
WithContext C(std::move(T.first));
302302
S.runWithAST(ID, Path, [&, ID](llvm::Expected<InputsAndAST> E) {

0 commit comments

Comments
 (0)