[clang] 757bdc6 - Fix clang unnittest build with GCC 5

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 01:31:13 PST 2020


Author: Benjamin Kramer
Date: 2020-01-29T10:30:36+01:00
New Revision: 757bdc64d33df61467a7122f22ea76cf163c8dca

URL: https://github.com/llvm/llvm-project/commit/757bdc64d33df61467a7122f22ea76cf163c8dca
DIFF: https://github.com/llvm/llvm-project/commit/757bdc64d33df61467a7122f22ea76cf163c8dca.diff

LOG: Fix clang unnittest build with GCC 5

Added: 
    

Modified: 
    clang/unittests/Frontend/PCHPreambleTest.cpp
    clang/unittests/Tooling/TransformerTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Frontend/PCHPreambleTest.cpp b/clang/unittests/Frontend/PCHPreambleTest.cpp
index 6136b0959497..d253d937ace9 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<MemoryBuffer> 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 454615c673de..1d955cf5e9b8 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<std::string> rewrite(StringRef Input) {


        


More information about the cfe-commits mailing list