[clang-tools-extra] r269796 - clang-rename: avoid StringRef members in USRLocFindingASTVisitor

Miklos Vajna via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 11:17:16 PDT 2016


Author: vmiklos
Date: Tue May 17 13:17:16 2016
New Revision: 269796

URL: http://llvm.org/viewvc/llvm-project?rev=269796&view=rev
Log:
clang-rename: avoid StringRef members in USRLocFindingASTVisitor

Even if this is defined in the .cpp file and only used as part of the
function (so here it's safe), usually storing StringRefs in the class is
dangerous, so don't do so.

Reviewers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D20296

Modified:
    clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp

Modified: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp?rev=269796&r1=269795&r2=269796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp Tue May 17 13:17:16 2016
@@ -123,9 +123,9 @@ private:
   }
 
   // All the locations of the USR were found.
-  StringRef USR;
+  const std::string USR;
   // Old name that is renamed.
-  StringRef PrevName;
+  const std::string PrevName;
   std::vector<clang::SourceLocation> LocationsFound;
 };
 } // namespace




More information about the cfe-commits mailing list