[llvm] [LLVM][TableGen] Use StringRef for various members `CGIOperandList::OperandInfo` (PR #140625)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 16:02:40 PDT 2025


================
@@ -142,8 +142,8 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
   }
 
   std::pair<unsigned, unsigned> SO = CGI.Operands.getSubOperandNumber(OpIdx);
-  std::string &EncoderMethodName =
-      CGI.Operands[SO.first].EncoderMethodNames[SO.second];
+  const std::string EncoderMethodName =
----------------
jurahul wrote:

It can, but then a simple string concat is now split over multiple lines. This will get better with my other PR (not yet uploaded) where this code:

Case += " " + EncoderMethodName + "(MI, " + utostr(OpIdx);

will stay the same, but `EncoderMethodName` can become a StringRef. Today the std::string conversion is for this line above to compile. 

Let me upload that PR and post a link here.

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


More information about the llvm-commits mailing list