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/slang/slang.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index bedfb1161..6b2814ca7 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -2385,7 +2385,7 @@ void FrontEndCompileRequest::generateIR() if (useSerialIRBottleneck) { // Keep the obfuscated source map (if there is one) - RefPtr obfuscatedSourceMap = irModule->getObfuscatedSourceMap(); + ComPtr> obfuscatedSourceMap(irModule->getObfuscatedSourceMap()); IRSerialData serialData; { @@ -4884,9 +4884,9 @@ SlangResult _addLibraryReference(EndToEndCompileRequest* req, IArtifact* artifac { ComPtr castable; SLANG_RETURN_ON_FAIL(associated->getOrCreateRepresentation(SourceMap::getTypeGuid(), ArtifactKeep::Yes, castable.writeRef())); - - auto sourceMap = as(castable); - + auto sourceMap = asBoxValue(castable); + SLANG_ASSERT(sourceMap); + // I guess we add to all ir modules? for (auto irModule : library->m_modules) -- cgit v1.2.3