diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-09-01 09:35:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-01 09:35:18 -0400 |
| commit | cd8715a7760189c54b36c0c250efbe1db5b8635c (patch) | |
| tree | cd1b2e840e64cbdd9e9a383646f0e58a7f14ae97 /source/compiler-core/slang-source-loc.h | |
| parent | 5c2c2cfc9918bb43225159e67a851e196e17759a (diff) | |
Passing source to Downstream compilation as artifacts (#2382)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Make DownstreamCompileOptions use POD types.
* CharSliceAllocator -> SliceAllocator
Added SliceConverter
CharSliceCaster -> SliceCaster
* First attempt at zero terminating around blobs.
* Fix clang warning.
* Add SlangTerminatedChars
Make Blob implementations support it.
Make most blobs 'terminated'.
* Fix bug setting up sourceFiles for CommandLineDownstreamCompiler.
* Traffic in TerminatedCharSlice for sourceFiles.
Use ArtifactDesc to generate temporary file names for source.
* Fix typo in testing for shared library/C++.
* Working with source being passed as artifacts to DownstreamCompiler.
* Use artifacts in SourceManager/SourceFile.
* Support infering extension from the original file extension.
Diffstat (limited to 'source/compiler-core/slang-source-loc.h')
| -rw-r--r-- | source/compiler-core/slang-source-loc.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/source/compiler-core/slang-source-loc.h b/source/compiler-core/slang-source-loc.h index 24471f3b0..461f09e96 100644 --- a/source/compiler-core/slang-source-loc.h +++ b/source/compiler-core/slang-source-loc.h @@ -9,6 +9,8 @@ #include "../../slang-com-ptr.h" #include "../../slang.h" +#include "slang-artifact-representation.h" + namespace Slang { /** Overview: @@ -60,6 +62,8 @@ struct PathInfo SLANG_FORCE_INLINE bool hasFoundPath() const { return type == Type::Normal || type == Type::FoundPath || (type == Type::FromString && foundPath.getLength() > 0); } /// True if has a found path that has originated from a file (as opposed to string or some other origin) SLANG_FORCE_INLINE bool hasFileFoundPath() const { return (type == Type::Normal || type == Type::FoundPath) && foundPath.getLength() > 0; } + /// Get the 'name'/path of the item. Will return an empty string if not applicable or not set. + String getName() const; bool operator==(const ThisType& rhs) const; bool operator!=(const ThisType& rhs) const { return !(*this == rhs); } @@ -232,11 +236,19 @@ public: /// Get path info const PathInfo& getPathInfo() const { return m_pathInfo; } + /// Get the (optional) assoicated artifact. Note its desc might be Source/Unknown + IArtifact* getArtifact() const { return m_artifact; } + /// Set the artifact + void setArtifact(IArtifact* artifact) { m_artifact = artifact; } + /// Set the content as a blob void setContents(ISlangBlob* blob); /// Set the content as a string void setContents(const String& content); + /// If artifact isn't defined will try and associate one. The pathInfo must be the one associated with the PathInfo + void maybeAddArtifact(ISlangFileSystemExt* ext); + /// Calculate a display path -> can canonicalize if necessary String calcVerbosePath() const; @@ -250,11 +262,13 @@ public: protected: - SourceManager* m_sourceManager; ///< The source manager this belongs to - PathInfo m_pathInfo; ///< The path The logical file path to report for locations inside this span. - ComPtr<ISlangBlob> m_contentBlob; ///< A blob that owns the storage for the file contents. If nullptr, there is no contents - UnownedStringSlice m_content; ///< The actual contents of the file. - size_t m_contentSize; ///< The size of the actual contents + SourceManager* m_sourceManager; ///< The source manager this belongs to + PathInfo m_pathInfo; ///< The path The logical file path to report for locations inside this span. + + ComPtr<IArtifact> m_artifact; ///< Optional artifact + ComPtr<ISlangBlob> m_contentBlob; ///< A blob that owns the storage for the file contents. If nullptr, there is no contents + UnownedStringSlice m_content; ///< The actual contents of the file. + size_t m_contentSize; ///< The size of the actual contents // In order to speed up lookup of line number information, // we will cache the starting offset of each line break in |
