From 8a61b9dd0ca729df894dad4c89c6ce3bf39ef0be Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 17 Mar 2023 11:05:15 -0400 Subject: Support for producing SourceMap on emit (#2707) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP source map. * Split out handling of RttiTypeFuncs to a map type. * Make RttiTypeFuncsMap hold default impls. * Slightly more sophisticated RttiTypeFuncsMap * Source map decoding. * Fix tabs. * Fix asserts due to negative values. * Use less obscure mechanisms in SourceMap. * Source map decoding. Simplifying SourceMap usage. * First attempt at ouputting a source map as part of emit. * Added support for -source-map option. SourceMap is added to the artifact. --- source/compiler-core/slang-artifact-desc-util.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/compiler-core/slang-artifact-desc-util.cpp') diff --git a/source/compiler-core/slang-artifact-desc-util.cpp b/source/compiler-core/slang-artifact-desc-util.cpp index fff68738c..ee014daf0 100644 --- a/source/compiler-core/slang-artifact-desc-util.cpp +++ b/source/compiler-core/slang-artifact-desc-util.cpp @@ -223,7 +223,8 @@ SLANG_HIERARCHICAL_ENUM(ArtifactKind, SLANG_ARTIFACT_KIND, SLANG_ARTIFACT_KIND_E x(Diagnostics, Metadata) \ x(Miscellaneous, Base) \ x(Log, Miscellaneous) \ - x(Lock, Miscellaneous) + x(Lock, Miscellaneous) \ + x(SourceMap, Base) #define SLANG_ARTIFACT_PAYLOAD_ENTRY(TYPE, PARENT) { Index(ArtifactPayload::TYPE), Index(ArtifactPayload::PARENT), #TYPE }, @@ -550,6 +551,13 @@ static const KindExtension g_cpuKindExts[] = return ArtifactDesc::make(ArtifactKind::Assembly, ArtifactPayload::HostCPU); } + // TODO(JS): Unfortunately map extension is also used from output for linkage from + // Visual Studio. It's used here for source map. + if (slice == toSlice("map")) + { + return ArtifactDesc::make(ArtifactKind::Text, ArtifactPayload::SourceMap); + } + if (slice == toSlice("pdb")) { // Program database @@ -621,6 +629,7 @@ static UnownedStringSlice _getPayloadExtension(ArtifactPayload payload) case Payload::MetalAIR: return toSlice("air"); case Payload::PdbDebugInfo: return toSlice("pdb"); + case Payload::SourceMap: return toSlice("map"); default: break; } -- cgit v1.2.3