2 changes: 1 addition & 1 deletion llvm/unittests/Bitstream/BitstreamWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST(BitstreamWriterTest, emitBlobWithSize) {
W.Emit('r', 8);
W.Emit(0, 8);
}
EXPECT_EQ(StringRef(Expected), Buffer);
EXPECT_EQ(Expected.str(), Buffer);
}

TEST(BitstreamWriterTest, emitBlobEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEST(DWARFDie, manualExtractDump) {
"0x0000000b: DW_TAG_compile_unit",
" DW_AT_name (\"/tmp/main.c\")",
" DW_AT_language (DW_LANG_C)"};
StringRef(Output).split(Strings, '\n', -1, false);
Output.str().split(Strings, '\n', -1, false);
ASSERT_EQ(Strings.size(), NumOfLines);
for (size_t I = 0; I < NumOfLines; ++I)
EXPECT_EQ(ValidStrings[I], Strings[I]);
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Support/CommandLineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ TEST(CommandLineTest, ReadConfigFile) {
llvm::SmallString<128> CurrDir;
std::error_code EC = llvm::sys::fs::current_path(CurrDir);
EXPECT_TRUE(!EC);
EXPECT_TRUE(StringRef(CurrDir) != TestDir.path());
EXPECT_NE(CurrDir.str(), TestDir.path());

llvm::BumpPtrAllocator A;
llvm::StringSaver Saver(A);
Expand Down
8 changes: 4 additions & 4 deletions llvm/unittests/Support/LockFileManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST(LockFileManagerTest, Basic) {
}

// Now that the lock is out of scope, the file should be gone.
EXPECT_FALSE(sys::fs::exists(StringRef(LockedFile)));
EXPECT_FALSE(sys::fs::exists(LockedFile.str()));
}

TEST(LockFileManagerTest, LinkLockExists) {
Expand All @@ -52,7 +52,7 @@ TEST(LockFileManagerTest, LinkLockExists) {
sys::path::append(TmpFileLock, "file.lock-000");

int FD;
std::error_code EC = sys::fs::openFileForWrite(StringRef(TmpFileLock), FD);
std::error_code EC = sys::fs::openFileForWrite(TmpFileLock.str(), FD);
ASSERT_FALSE(EC);

int Ret = close(FD);
Expand All @@ -61,7 +61,7 @@ TEST(LockFileManagerTest, LinkLockExists) {
EC = sys::fs::create_link(TmpFileLock.str(), FileLocK.str());
ASSERT_FALSE(EC);

EC = sys::fs::remove(StringRef(TmpFileLock));
EC = sys::fs::remove(TmpFileLock.str());
ASSERT_FALSE(EC);

{
Expand All @@ -72,7 +72,7 @@ TEST(LockFileManagerTest, LinkLockExists) {
}

// Now that the lock is out of scope, the file should be gone.
EXPECT_FALSE(sys::fs::exists(StringRef(LockedFile)));
EXPECT_FALSE(sys::fs::exists(LockedFile.str()));
}


Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/IR/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ StringRef SSANameState::uniqueValueName(StringRef name) {
while (true) {
probeName += llvm::utostr(nextConflictID++);
if (!usedNames.count(probeName)) {
name = StringRef(probeName).copy(usedNameAllocator);
name = probeName.str().copy(usedNameAllocator);
break;
}
probeName.resize(name.size() + 1);
Expand Down Expand Up @@ -1405,7 +1405,7 @@ static void printFloatValue(const APFloat &apValue, raw_ostream &os) {
apValue.toString(strValue);

// Make sure that we can parse the default form as a float.
if (StringRef(strValue).contains('.')) {
if (strValue.str().contains('.')) {
os << strValue;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Tools/mlir-lsp-server/lsp/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ LogicalResult JSONTransport::readStandardMessage(std::string &json) {
return failure();

// Content-Length is a mandatory header, and the only one we handle.
StringRef lineRef(line);
StringRef lineRef = line;
if (lineRef.consume_front("Content-Length: ")) {
llvm::getAsUnsignedInteger(lineRef.trim(), 0, contentLength);
} else if (!lineRef.trim().empty()) {
Expand Down Expand Up @@ -338,7 +338,7 @@ LogicalResult JSONTransport::readDelimitedMessage(std::string &json) {
json.clear();
llvm::SmallString<128> line;
while (succeeded(readLine(in, line))) {
StringRef lineRef = StringRef(line).trim();
StringRef lineRef = line.str().trim();
if (lineRef.startswith("//")) {
// Found a delimiter for the message.
if (lineRef == "// -----")
Expand Down