[all-commits] [llvm/llvm-project] 953086: [mlir][ODS] Use StringLiteral instead of StringRef...

Vladislav Vinogradov via All-commits all-commits at lists.llvm.org
Thu Feb 4 09:35:38 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 953086ddbb593289fafcf0e7cc6e74847f1635af
      https://github.com/llvm/llvm-project/commit/953086ddbb593289fafcf0e7cc6e74847f1635af
  Author: Vladislav Vinogradov <vlad.vinogradov at intel.com>
  Date:   2021-02-04 (Thu, 04 Feb 2021)

  Changed paths:
    M mlir/include/mlir/IR/OpBase.td
    M mlir/test/mlir-tblgen/op-decl.td
    M mlir/tools/mlir-tblgen/DialectGen.cpp
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
    M mlir/tools/mlir-tblgen/PassGen.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list