diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-03-27 13:57:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-27 10:57:42 -0700 |
| commit | ca1f93a916ce6b984cba402c8d3710988f2b618f (patch) | |
| tree | f39b638210d38efdc7e2bb746c06b881323d0f53 /source/compiler-core/slang-json-source-map-util.h | |
| parent | 2179480e28bdd46c71cec269a8f55ba93aa54f53 (diff) | |
Using SourceMap for location output (#2736)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP using SourceMap with SourceManager.
* Add a test to check obfuscation map is working.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/compiler-core/slang-json-source-map-util.h')
| -rw-r--r-- | source/compiler-core/slang-json-source-map-util.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-source-map-util.h b/source/compiler-core/slang-json-source-map-util.h new file mode 100644 index 000000000..51b11b6cd --- /dev/null +++ b/source/compiler-core/slang-json-source-map-util.h @@ -0,0 +1,21 @@ +#ifndef SLANG_COMPILER_CORE_JSON_SOURCE_MAP_UTIL_H +#define SLANG_COMPILER_CORE_JSON_SOURCE_MAP_UTIL_H + +#include "slang-source-map.h" + +#include "slang-json-value.h" + +namespace Slang { + +struct JSONSourceMapUtil +{ + /// Decode from root into the source map + static SlangResult decode(JSONContainer* container, JSONValue root, DiagnosticSink* sink, RefPtr<SourceMap>& out); + + /// Converts the source map contents into JSON + static SlangResult encode(SourceMap* sourceMap, JSONContainer* container, DiagnosticSink* sink, JSONValue& outValue); +}; + +} // namespace Slang + +#endif // SLANG_COMPILER_CORE_JSON_SOURCE_MAP_UTIL_H |
