[Mlir-commits] [llvm] [mlir] [NFC][TableGen] Use `Twine` for Name argument in CodeGenHelpers (PR #163581)
Craig Topper
llvmlistbot at llvm.org
Thu Oct 16 12:55:55 PDT 2025
================
@@ -13,17 +13,16 @@
#ifndef LLVM_TABLEGEN_CODEGENHELPERS_H
#define LLVM_TABLEGEN_CODEGENHELPERS_H
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
namespace llvm {
// Simple RAII helper for emitting ifdef-undef-endif scope.
class IfDefEmitter {
public:
- IfDefEmitter(raw_ostream &OS, StringRef Name) : Name(Name.str()), OS(OS) {
+ IfDefEmitter(raw_ostream &OS, const Twine &Name) : Name(Name.str()), OS(OS) {
----------------
topperc wrote:
The new code for NamespaceEmiter does String -> Twine -> std::string -> StringRef -> std::string because of the trim function. The old code trimmed a StringRef pointing to memory owned by the caller and only converted to std::string after trimming the StringRef.
https://github.com/llvm/llvm-project/pull/163581
More information about the Mlir-commits
mailing list