[TableGen] Tach getInputFilename to return StringRef (NFC) (#140690)

AFAICT, all callers of getInputFilename consume the string right away.
Nobody seems to rely on the "copy" behavior that comes with returning
"const std::string".
This commit is contained in:
Kazu Hirata
2025-05-20 06:47:18 -07:00
committed by GitHub
parent 822db01319
commit 86f2fdd5e4
2 changed files with 2 additions and 2 deletions

View File

@@ -1981,7 +1981,7 @@ public:
detail::RecordKeeperImpl &getImpl() { return *Impl; }
/// Get the main TableGen input file's name.
const std::string getInputFilename() const { return InputFilename; }
StringRef getInputFilename() const { return InputFilename; }
/// Get the map of classes.
const RecordMap &getClasses() const { return Classes; }

View File

@@ -27,7 +27,7 @@ using namespace mlir::tblgen;
static std::string getUniqueOutputLabel(const RecordKeeper &records,
StringRef tag) {
// Use the input file name when generating a unique name.
std::string inputFilename = records.getInputFilename();
StringRef inputFilename = records.getInputFilename();
// Drop all but the base filename.
StringRef nameRef = sys::path::filename(inputFilename);