r330277 - [MinGW] Try to fix asan testing after r330244

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 18 10:34:30 PDT 2018


Author: mstorsjo
Date: Wed Apr 18 10:34:29 2018
New Revision: 330277

URL: http://llvm.org/viewvc/llvm-project?rev=330277&view=rev
Log:
[MinGW] Try to fix asan testing after r330244

Twines shouldn't be stored as they can refer to temporaries.

Modified:
    cfe/trunk/lib/Driver/ToolChains/MinGW.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=330277&r1=330276&r2=330277&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Wed Apr 18 10:34:29 2018
@@ -308,14 +308,13 @@ llvm::ErrorOr<std::string> toolchains::M
   Subdirs.emplace_back(getTriple().str());
   Subdirs.emplace_back(getTriple().getArchName());
   Subdirs[1] += "-w64-mingw32";
-  Twine ClangRoot =
-      llvm::sys::path::parent_path(getDriver().getInstalledDir()) +
-      llvm::sys::path::get_separator();
+  StringRef ClangRoot =
+      llvm::sys::path::parent_path(getDriver().getInstalledDir());
+  StringRef Sep = llvm::sys::path::get_separator();
   for (StringRef CandidateSubdir : Subdirs) {
-    Twine Subdir = ClangRoot + CandidateSubdir;
-    if (llvm::sys::fs::is_directory(Subdir)) {
+    if (llvm::sys::fs::is_directory(ClangRoot + Sep + CandidateSubdir)) {
       Arch = CandidateSubdir;
-      return Subdir.str();
+      return (ClangRoot + Sep + CandidateSubdir).str();
     }
   }
   return make_error_code(std::errc::no_such_file_or_directory);




More information about the cfe-commits mailing list