[clang] [Clang][TableGen] Use StringRef in FlattenedSpelling (PR #113809)

Rahul Joshi via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 11:19:33 PDT 2024


================
@@ -49,40 +49,38 @@ using namespace llvm;
 namespace {
 
 class FlattenedSpelling {
-  std::string V, N, NS;
+  StringRef V, N, NS;
----------------
jurahul wrote:

In all these instances, the strings are derived from TableGen Records, so they do outlive. I do agree that TG is not perf critical, so if we prefer peace of mind here, we can just go with my previous PR. On the flip side, so many other TableGen backends rely on this behavior (that is, StringRefs derived from Records are stashed in other places, for example see `CodeGenIntrinsic` so this is in keeping with the current precedent). 

https://github.com/llvm/llvm-project/pull/113809


More information about the cfe-commits mailing list