[clang] bd31243 - Fix more implicit conversions. Getting closer to having clang working with gcc 5 again

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 17:59:25 PST 2020


Author: Benjamin Kramer
Date: 2020-01-29T02:57:59+01:00
New Revision: bd31243a34da8a045c642ddc77b27b0a45a9bf1e

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

LOG: Fix more implicit conversions. Getting closer to having clang working with gcc 5 again

Added: 
    

Modified: 
    clang/lib/ARCMigrate/ObjCMT.cpp
    clang/lib/CodeGen/CGObjCGNU.cpp
    clang/lib/Frontend/InitHeaderSearch.cpp
    clang/lib/Frontend/TextDiagnosticBuffer.cpp
    llvm/tools/llvm-cov/CodeCoverage.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index 6ef0786826f8..51c4a460cc25 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -2269,7 +2269,7 @@ bool arcmt::getFileRemappingsFromFileList(
       continue;
     }
 
-    remap.emplace_back(I->first->getName(), TempFile);
+    remap.emplace_back(std::string(I->first->getName()), TempFile);
   }
 
   return hasErrorOccurred;

diff  --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index e93aca00e97d..61801e0e815b 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1946,7 +1946,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
 
       if (SuperClass) {
         std::pair<llvm::Constant*, int> v{classStruct, 1};
-        EarlyInitList.emplace_back(SuperClass->getName(), std::move(v));
+        EarlyInitList.emplace_back(std::string(SuperClass->getName()),
+                                   std::move(v));
       }
 
     }

diff  --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
index 6050ea09a9ec..851f5a4cc05c 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -65,7 +65,7 @@ class InitHeaderSearch {
   /// AddSystemHeaderPrefix - Add the specified prefix to the system header
   /// prefix list.
   void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {
-    SystemHeaderPrefixes.emplace_back(Prefix, IsSystemHeader);
+    SystemHeaderPrefixes.emplace_back(std::string(Prefix), IsSystemHeader);
   }
 
   /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu

diff  --git a/clang/lib/Frontend/TextDiagnosticBuffer.cpp b/clang/lib/Frontend/TextDiagnosticBuffer.cpp
index b2497f56cbcd..90f273e65f88 100644
--- a/clang/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/clang/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -32,20 +32,20 @@ void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
                          "Diagnostic not handled during diagnostic buffering!");
   case DiagnosticsEngine::Note:
     All.emplace_back(Level, Notes.size());
-    Notes.emplace_back(Info.getLocation(), Buf.str());
+    Notes.emplace_back(Info.getLocation(), std::string(Buf.str()));
     break;
   case DiagnosticsEngine::Warning:
     All.emplace_back(Level, Warnings.size());
-    Warnings.emplace_back(Info.getLocation(), Buf.str());
+    Warnings.emplace_back(Info.getLocation(), std::string(Buf.str()));
     break;
   case DiagnosticsEngine::Remark:
     All.emplace_back(Level, Remarks.size());
-    Remarks.emplace_back(Info.getLocation(), Buf.str());
+    Remarks.emplace_back(Info.getLocation(), std::string(Buf.str()));
     break;
   case DiagnosticsEngine::Error:
   case DiagnosticsEngine::Fatal:
     All.emplace_back(Level, Errors.size());
-    Errors.emplace_back(Info.getLocation(), Buf.str());
+    Errors.emplace_back(Info.getLocation(), std::string(Buf.str()));
     break;
   }
 }

diff  --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 4444fe6bc1af..52e9958e92da 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -245,7 +245,8 @@ CodeCoverageTool::getSourceFile(StringRef SourceFile) {
     error(EC.message(), SourceFile);
     return EC;
   }
-  LoadedSourceFiles.emplace_back(SourceFile, std::move(Buffer.get()));
+  LoadedSourceFiles.emplace_back(std::string(SourceFile),
+                                 std::move(Buffer.get()));
   return *LoadedSourceFiles.back().second;
 }
 


        


More information about the cfe-commits mailing list