[llvm] Allow SMLoc to be used in constexpr context
authorwren romano <2998727+wrengr@users.noreply.github.com>
Fri, 7 Jul 2023 19:46:32 +0000 (12:46 -0700)
committerwren romano <2998727+wrengr@users.noreply.github.com>
Mon, 17 Jul 2023 18:45:22 +0000 (11:45 -0700)
commit47cf7a4ba54edf7c2a78503d7cca8a003f194d32
treeaac308c04e97e9a009e45bd2445c0c5912183fc6
parent486be17ddaf639dc13b8df4ba078f2677f0c5829
[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
llvm/include/llvm/Support/SMLoc.h
mlir/lib/Dialect/SparseTensor/IR/Detail/Var.h