File indexing completed on 2026-05-10 08:44:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_SUPPORT_SMLOC_H
0015 #define LLVM_SUPPORT_SMLOC_H
0016
0017 #include <cassert>
0018 #include <optional>
0019
0020 namespace llvm {
0021
0022
0023 class SMLoc {
0024 const char *Ptr = nullptr;
0025
0026 public:
0027 constexpr SMLoc() = default;
0028
0029 constexpr bool isValid() const { return Ptr != nullptr; }
0030
0031 constexpr bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
0032 constexpr bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }
0033
0034 constexpr const char *getPointer() const { return Ptr; }
0035
0036 static SMLoc getFromPointer(const char *Ptr) {
0037 SMLoc L;
0038 L.Ptr = Ptr;
0039 return L;
0040 }
0041 };
0042
0043
0044
0045
0046
0047
0048 class SMRange {
0049 public:
0050 SMLoc Start, End;
0051
0052 SMRange() = default;
0053 SMRange(std::nullopt_t) {}
0054 SMRange(SMLoc St, SMLoc En) : Start(St), End(En) {
0055 assert(Start.isValid() == End.isValid() &&
0056 "Start and End should either both be valid or both be invalid!");
0057 }
0058
0059 bool isValid() const { return Start.isValid(); }
0060 };
0061
0062 }
0063
0064 #endif