r330710 - [GCC] Don't keep a StringRef to a temporary std::string

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 24 04:57:02 PDT 2018


Author: mstorsjo
Date: Tue Apr 24 04:57:02 2018
New Revision: 330710

URL: http://llvm.org/viewvc/llvm-project?rev=330710&view=rev
Log:
[GCC] Don't keep a StringRef to a temporary std::string

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.

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

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=330710&r1=330709&r2=330710&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 24 04:57:02 2018
@@ -1616,7 +1616,7 @@ Generic_GCC::GCCVersion Generic_GCC::GCC
   //   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.




More information about the cfe-commits mailing list