diff --git a/clang/unittests/Frontend/PCHPreambleTest.cpp b/clang/unittests/Frontend/PCHPreambleTest.cpp index 6136b09594970..d253d937ace97 100644 --- a/clang/unittests/Frontend/PCHPreambleTest.cpp +++ b/clang/unittests/Frontend/PCHPreambleTest.cpp @@ -117,7 +117,7 @@ class PCHPreambleTest : public ::testing::Test { for (const auto &RemappedFile : RemappedFiles) { std::unique_ptr buf = MemoryBuffer::getMemBufferCopy( RemappedFile.second, RemappedFile.first()); - Remapped.emplace_back(RemappedFile.first(), buf.release()); + Remapped.emplace_back(std::string(RemappedFile.first()), buf.release()); } return Remapped; } diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp index 454615c673deb..1d955cf5e9b80 100644 --- a/clang/unittests/Tooling/TransformerTest.cpp +++ b/clang/unittests/Tooling/TransformerTest.cpp @@ -81,7 +81,7 @@ class ClangRefactoringTestBase : public testing::Test { void appendToHeader(StringRef S) { FileContents[0].second += S; } void addFile(StringRef Filename, StringRef Content) { - FileContents.emplace_back(Filename, Content); + FileContents.emplace_back(std::string(Filename), std::string(Content)); } llvm::Optional rewrite(StringRef Input) {