Skip to content

Commit 86f2fdd

Browse files
[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".
1 parent 822db01 commit 86f2fdd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/TableGen/Record.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ class RecordKeeper {
19811981
detail::RecordKeeperImpl &getImpl() { return *Impl; }
19821982

19831983
/// Get the main TableGen input file's name.
1984-
const std::string getInputFilename() const { return InputFilename; }
1984+
StringRef getInputFilename() const { return InputFilename; }
19851985

19861986
/// Get the map of classes.
19871987
const RecordMap &getClasses() const { return Classes; }

mlir/lib/TableGen/CodeGenHelpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using namespace mlir::tblgen;
2727
static std::string getUniqueOutputLabel(const RecordKeeper &records,
2828
StringRef tag) {
2929
// Use the input file name when generating a unique name.
30-
std::string inputFilename = records.getInputFilename();
30+
StringRef inputFilename = records.getInputFilename();
3131

3232
// Drop all but the base filename.
3333
StringRef nameRef = sys::path::filename(inputFilename);

0 commit comments

Comments
 (0)