From 588991f6df3d6813378721166a7260990835817e Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 19 Apr 2023 17:06:56 -0400 Subject: Make SourceMap a value type (#2812) * #include an absolute path didn't work - because paths were taken to always be relative. * Moved JSON source map writing logic to JSONSourceMapUtil. * Use ArtifactHandler to read/write SourceMaps. Use ObjectCastableAdapter to hold SourceMap Only serialize SourceMap <-> JSON on demand. * Make some types swappable. * BoxValue impl. * Added asBoxValue. * Remove const get funcs. * Fix typo in asBoxValue. * Fix another typo in asBoxValue. * Slightly simplify conversion to blob of SourceMap. * Small fix for asBoxValue --- source/compiler-core/slang-source-map.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/compiler-core/slang-source-map.h') diff --git a/source/compiler-core/slang-source-map.h b/source/compiler-core/slang-source-map.h index f1338508f..e0c8d065a 100644 --- a/source/compiler-core/slang-source-map.h +++ b/source/compiler-core/slang-source-map.h @@ -10,9 +10,11 @@ namespace Slang { -class SourceMap : public RefObject +class SourceMap { public: + typedef SourceMap ThisType; + SLANG_CLASS_GUID(0x731383ea, 0xe516, 0x4cc3, { 0xa6, 0xcf, 0x37, 0xd2, 0x8c, 0x24, 0x5c, 0x5e }); struct Entry @@ -66,6 +68,9 @@ public: /// Clear the contents of the source map void clear(); + /// Swap this with rhs + void swapWith(ThisType& rhs); + /// Ctor SourceMap(): m_slicePool(StringSlicePool::Style::Default) -- cgit v1.2.3