diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-07-18 18:45:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-18 15:45:38 -0700 |
| commit | 1fe5e83f3dcc8ef0efa2dd083ebdfab5d0f101a9 (patch) | |
| tree | 9ea88993d0b1f5cad76c21ae3a60ed561bdc3c83 /source/compiler-core/slang-source-loc.h | |
| parent | 4cb3eeb832b5fb29a61f2934b3daa5e42a3d6cde (diff) | |
nsight Aftermath crash example (#2984)
* Small fixes and improvements around reflection tool.
* Make PrettyWriter printing a class.
* Aftermath crash demo WIP.
* Enable aftermath in test project.
* Setting failCount.
* Dumping out of source maps.
* Improve comments.
Simplify handling of compile products.
* Other small fixes to aftermath example.
* Added Emit SourceLocType.
Track sourcemap association meaning.
Improved documentation.
* Small improvements.
* Capture debug information for D3D11/D3D12/Vulkan.
* Enable debug info.
* Small improvements.
* Improve aftermath example README.md.
Diffstat (limited to 'source/compiler-core/slang-source-loc.h')
| -rw-r--r-- | source/compiler-core/slang-source-loc.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/compiler-core/slang-source-loc.h b/source/compiler-core/slang-source-loc.h index fafff7de6..5c78c4293 100644 --- a/source/compiler-core/slang-source-loc.h +++ b/source/compiler-core/slang-source-loc.h @@ -164,6 +164,16 @@ struct SourceRange SourceLoc end; }; +/// Source maps associated with files are could be of different uses. We use the SourceMapKind +/// to indicate the usage. +/// +/// If the source map is obfuscated reasonable/desirable to ignore them on emit (if we didn't we leak information, +/// and we don't emit into the locations in the obfuscated intermediate "file"). +enum class SourceMapKind +{ + Normal, ///< A regular source map + Obfuscated, ///< Obfuscated source map +}; // Pre-declare struct SourceManager; @@ -256,8 +266,11 @@ public: /// Get the source map associated with this file. If it's set when doing /// lookup for source locations, the source map will be used IBoxValue<SourceMap>* getSourceMap() const { return m_sourceMap; } + /// Get the source map kind + SourceMapKind getSourceMapKind() const { return m_sourceMapKind; } + /// Set a source map - void setSourceMap(IBoxValue<SourceMap>* sourceMap) { m_sourceMap = sourceMap; } + void setSourceMap(IBoxValue<SourceMap>* sourceMap, SourceMapKind sourceMapKind) { m_sourceMap = sourceMap; m_sourceMapKind = sourceMapKind; } /// Ctor SourceFile(SourceManager* sourceManager, const PathInfo& pathInfo, size_t contentSize); @@ -281,12 +294,15 @@ public: // If set then the locations in this file are really from locations from elsewhere, // where the SourceMap specifies that mapping ComPtr<IBoxValue<SourceMap>> m_sourceMap; + // What kind of source map it is (if there is one) + SourceMapKind m_sourceMapKind = SourceMapKind::Normal; }; enum class SourceLocType { Nominal, ///< The normal interpretation which takes into account #line directives and source maps Actual, ///< Ignores #line directives/source maps - and is the location as seen in the actual file + Emit, ///< Behaves the same as `Nominal` but ignores source maps. Used for Emit source locations. }; // A source location in a format a human might like to see @@ -395,6 +411,8 @@ class SourceView /// Get the pathInfo from a string handle. If it's 0, it will return the _getPathInfo PathInfo _getPathInfoFromHandle(StringSlicePool::Handle pathHandle) const; + SlangResult _findSourceMapLoc(SourceLoc loc, SourceLocType type, HandleSourceLoc& outLoc); + String m_viewPath; ///< Path to this view. If empty the path is the path to the SourceView SourceLoc m_initiatingSourceLoc; ///< An optional source loc that defines where this view was initiated from. SourceLoc(0) if not defined. |
