[PATCH] D20216: clang-rename: check that the source location we find actually has the old name

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 01:47:51 PDT 2016


klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


================
Comment at: clang-rename/USRLocFinder.cpp:126-128
@@ -118,3 +125,5 @@
   // All the locations of the USR were found.
-  const std::string USR;
+  StringRef USR;
+  // Old name that is renamed.
+  StringRef PrevName;
   std::vector<clang::SourceLocation> LocationsFound;
----------------
Usually storing StringRefs in the class is dangerous, but as this is defined in the .cpp file and only used as part of the function, that's probably fine.
(I personally would still make them std::string members, and copy either in the constructor or when passing into the function).


http://reviews.llvm.org/D20216





More information about the cfe-commits mailing list