From 3a83c5c9f7414220e66c6cd293716a7e13fd2c23 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 18 Apr 2018 17:34:29 +0000 Subject: [PATCH] [MinGW] Try to fix asan testing after r330244 Twines shouldn't be stored as they can refer to temporaries. llvm-svn: 330277 --- clang/lib/Driver/ToolChains/MinGW.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 312acde3bc1e..206f52e82d0b 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -308,14 +308,13 @@ llvm::ErrorOr toolchains::MinGW::findClangRelativeSysroot() { 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);