[PATCH] D20296: clang-rename: avoid StringRef members in USRLocFindingASTVisitor

Miklos Vajna via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 12:49:08 PDT 2016

vmiklos created this revision.
vmiklos added reviewers: klimek, cfe-commits.

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.



Index: clang-rename/USRLocFinder.cpp
--- clang-rename/USRLocFinder.cpp
+++ clang-rename/USRLocFinder.cpp
@@ -123,9 +123,9 @@
   // 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20296.57385.patch
Type: text/x-patch
Size: 451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160516/2b0865cb/attachment.bin>

More information about the cfe-commits mailing list