[llvm-branch-commits] [cfe-branch] r143952 - in /cfe/branches/release_30: ./ lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h

Chandler Carruth chandlerc at gmail.com
Mon Nov 7 02:41:56 PST 2011


Author: chandlerc
Date: Mon Nov  7 04:41:56 2011
New Revision: 143952

URL: http://llvm.org/viewvc/llvm-project?rev=143952&view=rev
Log:
Merging r143875:
------------------------------------------------------------------------
r143875 | chandlerc | 2011-11-06 02:51:30 -0800 (Sun, 06 Nov 2011) | 2 lines

The version objects need to actually store the version strings; they
aren't guaranteed to live long enough otherwise.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/lib/Driver/ToolChains.cpp
    cfe/branches/release_30/lib/Driver/ToolChains.h

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  7 04:41:56 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143842,143863,143866,143869,143871,143873-143874
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143842,143863,143866,143869,143871,143873-143875
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/ToolChains.cpp?rev=143952&r1=143951&r2=143952&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/ToolChains.cpp (original)
+++ cfe/branches/release_30/lib/Driver/ToolChains.cpp Mon Nov  7 04:41:56 2011
@@ -1525,11 +1525,11 @@
 ///
 /// 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<StringRef, StringRef> First = VersionText.split('.');
   std::pair<StringRef, StringRef> 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;
@@ -1546,14 +1546,14 @@
   //   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();
     }
   }
 

Modified: cfe/branches/release_30/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/ToolChains.h?rev=143952&r1=143951&r2=143952&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/ToolChains.h (original)
+++ cfe/branches/release_30/lib/Driver/ToolChains.h Mon Nov  7 04:41:56 2011
@@ -389,13 +389,13 @@
   /// becomes necessary, it can be added.
   struct GCCVersion {
     /// \brief The unparsed text of the version.
-    StringRef Text;
+    std::string Text;
 
     /// \brief The parsed major, minor, and patch numbers.
     int Major, Minor, Patch;
 
     /// \brief Any textual suffix on the patch number.
-    StringRef PatchSuffix;
+    std::string PatchSuffix;
 
     static GCCVersion Parse(StringRef VersionText);
     bool operator<(const GCCVersion &RHS) const;





More information about the llvm-branch-commits mailing list