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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 11:15:14 PDT 2024


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

I'm not keen on this change; it may be correct, but it's pretty dangerous too because this now requires `FlattenedSpelling` to outlive the memory owned by the passed in string references. Keeping a `std::string` here introduces a copy, but that seems reasonable (tablegen is not really performance critical anyway). WDYT?

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


More information about the cfe-commits mailing list