[mlir][ODS] Use StringLiteral instead of StringRef when applicable
authorVladislav Vinogradov <vlad.vinogradov@intel.com>
Thu, 4 Feb 2021 17:12:15 +0000 (17:12 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Thu, 4 Feb 2021 17:35:15 +0000 (17:35 +0000)
commit953086ddbb593289fafcf0e7cc6e74847f1635af
tree9a5cba0c4591a9b1fec9f1bcfb2dc2fd7b705ff7
parented399d508ff6e0df657e251afe936fac713ff417
[mlir][ODS] Use StringLiteral instead of StringRef when applicable

Use `StringLiteral` for function return type if it is known to return
constant string literals only.

This will make it visible to API users, that such values can be safely
stored, since they refers to constant data, which will never be deallocated.

`StringRef` is general is not safe to store for a long term,
since it might refer to temporal data allocated in heap.

Reviewed By: mehdi_amini, bkramer

Differential Revision: https://reviews.llvm.org/D95945
mlir/include/mlir/IR/OpBase.td
mlir/test/mlir-tblgen/op-decl.td
mlir/tools/mlir-tblgen/DialectGen.cpp
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/PassGen.cpp