Skip to content

Commit 32d2b14

Browse files
committed
Fix build breaks for master-next against llvm.org.
StringRef conversion to std::string needs to be explicit now.
1 parent e92599f commit 32d2b14

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

unittests/Basic/PrefixMapTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Tester {
4040
// Performs an insert operation and tests that the result matches what
4141
// we get from the std::map.
4242
void insert(StringRef key, int value) {
43-
auto stdmapResult = StdMap.insert({key, value});
43+
auto stdmapResult = StdMap.insert({key.str(), value});
4444
auto premapResult = PreMap.insert(asArray(key), value);
4545

4646
// Whether or not we modified the map should be the same in both
@@ -57,7 +57,7 @@ struct Tester {
5757
// Tests that the result of a findPrefix matches what we expect from
5858
// the std::map.
5959
void find(StringRef key) {
60-
auto stdmapResult = StdMap.lower_bound(key);
60+
auto stdmapResult = StdMap.lower_bound(key.str());
6161
while (stdmapResult == StdMap.end() ||
6262
!key.startswith(stdmapResult->first)) {
6363
if (stdmapResult == StdMap.begin()) {

unittests/ClangImporter/ClangImporterTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static bool emitFileWithContents(StringRef path, StringRef contents,
2525
if (llvm::sys::fs::openFileForWrite(path, FD))
2626
return true;
2727
if (pathOut)
28-
*pathOut = path;
28+
*pathOut = path.str();
2929
llvm::raw_fd_ostream file(FD, /*shouldClose=*/true);
3030
file << contents;
3131
return false;

unittests/FrontendTool/ModuleLoadingTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static bool emitFileWithContents(StringRef path, StringRef contents,
3333
if (llvm::sys::fs::openFileForWrite(path, fd))
3434
return true;
3535
if (pathOut)
36-
*pathOut = path;
36+
*pathOut = path.str();
3737
llvm::raw_fd_ostream file(fd, /*shouldClose=*/true);
3838
file << contents;
3939
return false;

unittests/IDE/Placeholders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static std::string replaceFromString(const std::string &S,
1111
auto Buf = llvm::MemoryBuffer::getMemBufferCopy(S, "");
1212

1313
Buf = ide::replacePlaceholders(std::move(Buf), HadPH);
14-
return Buf->getBuffer();
14+
return Buf->getBuffer().str();
1515
}
1616

1717
TEST(Placeholders, Replace) {
@@ -83,6 +83,6 @@ TEST(Placeholders, TooShort) {
8383
Source += "<##>\n";
8484
}
8585
std::string Out = replaceFromString(Source);
86-
std::string Last = StringRef(Out).substr(Out.size()-15);
86+
std::string Last(StringRef(Out).substr(Out.size()-15));
8787
EXPECT_EQ("$_99\n$___\n$___\n", Last);
8888
}

unittests/SourceKit/SwiftLang/CursorInfoTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ class CursorInfoTest : public ::testing::Test {
151151
[&](const RequestResult<CursorInfoData> &Result) {
152152
assert(!Result.isCancelled());
153153
if (Result.isError()) {
154-
TestInfo.Error = Result.getError();
154+
TestInfo.Error = Result.getError().str();
155155
sema.signal();
156156
return;
157157
}
158158
const CursorInfoData &Info = Result.value();
159-
TestInfo.Name = Info.Name;
160-
TestInfo.Typename = Info.TypeName;
161-
TestInfo.Filename = Info.Filename;
159+
TestInfo.Name = Info.Name.str();
160+
TestInfo.Typename = Info.TypeName.str();
161+
TestInfo.Filename = Info.Filename.str();
162162
TestInfo.DeclarationLoc = Info.DeclarationLoc;
163163
sema.signal();
164164
});

0 commit comments

Comments
 (0)