[all-commits] [llvm/llvm-project] 47cf7a: [llvm] Allow SMLoc to be used in constexpr context

wren romano via All-commits all-commits at lists.llvm.org
Mon Jul 17 11:45:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47cf7a4ba54edf7c2a78503d7cca8a003f194d32
      https://github.com/llvm/llvm-project/commit/47cf7a4ba54edf7c2a78503d7cca8a003f194d32
  Author: wren romano <2998727+wrengr at users.noreply.github.com>
  Date:   2023-07-17 (Mon, 17 Jul 2023)

  Changed paths:
    M llvm/include/llvm/Support/SMLoc.h
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.h

  Log Message:
  -----------
  [llvm] Allow SMLoc to be used in constexpr context

Since `StringRef::empty` can be used in constexpr context, it seems reasonable that `SMLoc::isValid` should be too.  The default-ctor and `operator==` are made constexpr for consistency.

In particular, the `constexpr` keyword is needed for silencing warnings on Windows (whereas Linux allows constexpr usage without the keyword).

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D154741




More information about the All-commits mailing list