From 0ad080e720c4e4debcd059fddfbd1d948c7214c0 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 6 Nov 2011 10:51:30 +0000 Subject: The version objects need to actually store the version strings; they aren't guaranteed to live long enough otherwise. llvm-svn: 143875 --- clang/lib/Driver/ToolChains.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'clang/lib/Driver/ToolChains.cpp') diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index ec6aea79262..159d2afcd0e 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -1523,11 +1523,11 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { /// /// This is the primary means of forming GCCVersion objects. /*static*/ Linux::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) { - const GCCVersion BadVersion = { VersionText, -1, -1, -1, "" }; + const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" }; std::pair First = VersionText.split('.'); std::pair Second = First.second.split('.'); - GCCVersion GoodVersion = { VersionText, -1, -1, -1, "" }; + GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" }; if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0) return BadVersion; @@ -1544,14 +1544,14 @@ static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { // 4.4.2-rc4 // 4.4.x-patched // And retains any patch number it finds. - StringRef PatchText = GoodVersion.PatchSuffix = Second.second; + StringRef PatchText = GoodVersion.PatchSuffix = Second.second.str(); if (!PatchText.empty()) { if (unsigned EndNumber = PatchText.find_first_not_of("0123456789")) { // Try to parse the number and any suffix. if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) || GoodVersion.Patch < 0) return BadVersion; - GoodVersion.PatchSuffix = PatchText.substr(EndNumber); + GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str(); } } -- cgit v1.2.3