]> granicus.if.org Git - clang/commitdiff
[GCC] Don't keep a StringRef to a temporary std::string
authorMartin Storsjo <martin@martin.st>
Tue, 24 Apr 2018 11:57:02 +0000 (11:57 +0000)
committerMartin Storsjo <martin@martin.st>
Tue, 24 Apr 2018 11:57:02 +0000 (11:57 +0000)
This fixes failures in asan builds and possibly other buildbots
as well, after SVN r330696.

Prior to that revision, the std::string was stored in another
variable, before assigning to a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330710 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Gnu.cpp

index 92c6a39887665d7da49d652c56dba5791a9bfcb0..39de858e11840e3868e47139232e09563c2e6294 100644 (file)
@@ -1616,7 +1616,7 @@ Generic_GCC::GCCVersion Generic_GCC::GCCVersion::Parse(StringRef VersionText) {
   //   4.4.2-rc4
   //   4.4.x-patched
   // And retains any patch number it finds.
-  StringRef PatchText = Second.second.str();
+  StringRef PatchText = Second.second;
   if (!PatchText.empty()) {
     if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) {
       // Try to parse the number and any suffix.