diff options
Diffstat (limited to 'source/compiler-core/slang-source-map.h')
| -rw-r--r-- | source/compiler-core/slang-source-map.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/compiler-core/slang-source-map.h b/source/compiler-core/slang-source-map.h index e0c8d065a..0c55d3a1a 100644 --- a/source/compiler-core/slang-source-map.h +++ b/source/compiler-core/slang-source-map.h @@ -19,6 +19,8 @@ public: struct Entry { + typedef Entry ThisType; + void init() { generatedColumn = 0; @@ -28,6 +30,16 @@ public: nameIndex = 0; } + bool operator==(const ThisType& rhs) const + { + return generatedColumn == rhs.generatedColumn && + sourceFileIndex == rhs.sourceFileIndex && + sourceLine == rhs.sourceLine && + sourceColumn == rhs.sourceColumn && + nameIndex == rhs.nameIndex; + } + SLANG_FORCE_INLINE bool operator!=(const ThisType& rhs) const { return !(*this == rhs); } + // Note! All column/line are zero indexed Index generatedColumn; ///< The generated column Index sourceFileIndex; ///< The index into the source name/contents @@ -71,12 +83,24 @@ public: /// Swap this with rhs void swapWith(ThisType& rhs); + /// == + /// + /// Note that equality requires that entries for a line must be *in the same order* + /// even though strictly speaking with different orders could be considered equivalent. + bool operator==(const ThisType& rhs) const; + /// != + bool operator!=(const ThisType& rhs) const { return !(*this == rhs); } + /// Ctor SourceMap(): m_slicePool(StringSlicePool::Style::Default) { clear(); } + /// Copy Ctor + SourceMap(const ThisType& rhs) = default; + /// Assignment + ThisType& operator=(const ThisType& rhs) = default; String m_file; String m_sourceRoot; |
