diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-10 11:37:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 11:37:26 -0400 |
| commit | fcdb4629c4c3dd2931eaa88b96b668d914c4519c (patch) | |
| tree | c54c0b9c6411f9be55b9a2816e528b91d6032703 /source/compiler-core/slang-artifact-representation-impl.h | |
| parent | 1378fffd9da094beb41b2db89b96f556c23ab6cb (diff) | |
Yet more refactoring around Artifact (#2352)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP with hierarchical enums.
* Some small fixes and improvements around artifact desc related types.
* Improvements around hierarchical enum.
* Fixes to get Artifact types refactor to be able to execute tests.
* Attempt to better categorize PTX.
* Work around for potentially unused function warning.
* Typo fix.
* Simplify Artifact header.
* Small improvements around Artifact kind/payload/style.
* Added IDestroyable/ICastable
* Add IArtifactList.
* First impl of IArtifactUtil.
* Use the ICastable interface for IArtifactRepresentation.
* Added IArtifactRepresentation & IArtifactAssociated.
* Add SLANG_OVERRIDE to avoid gcc/clang warning.
* Fix calling convention issue on win32.
* Fix missing SLANG_OVERRIDE.
* First attempt at file abstraction around Artifact.
* Added creation of lock file.
* Move functionality for determining file paths to the IArtifactUtil.
Add casting to ICastable.
* Added some casting/finding mechanisms.
* Simplify IArtifact interface, and use Items for file reps.
* Fix problem with libraries on DXIL.
* Split out ArtifactRepresentation.
* Move ArtifactDesc functionality to ArtifactDescUtil. ArtifactInfoUtil becomes ArtifactDescUtil.
* Split implementations from the interfaces for Artifact.
* Use TypeTextUtil for target name outputting.
* Add artifact impls.
* Add ICastableList
* Added UnknownCastableAdapter
* Make ISlangSharedLibrary derive from ICastable, and remain backwards compatible with slang-llvm.
* Refactor Representation on Artifact.
* Make our ISlangBlobs also derive from ICastable.
Make ISlangBlob atomic ref counted.
* Split out CastableList and related types, and placed in core.
* Small fixes around IArtifact.
Improve IArtifact docs.
First impl of getChildren for IArtifact.
* Documentation improvements for Artifact related types.
* Fix typo.
* Special case adding a ICastableList to a LazyCastableList.
* Small simplification of LazyCastableList, by adding State member.
* Removed the ILockFile interface because IFileArtifactRepresentation can be used.
Diffstat (limited to 'source/compiler-core/slang-artifact-representation-impl.h')
| -rw-r--r-- | source/compiler-core/slang-artifact-representation-impl.h | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/source/compiler-core/slang-artifact-representation-impl.h b/source/compiler-core/slang-artifact-representation-impl.h index 9c2066e55..a40adf0e9 100644 --- a/source/compiler-core/slang-artifact-representation-impl.h +++ b/source/compiler-core/slang-artifact-representation-impl.h @@ -12,41 +12,7 @@ namespace Slang { -/* An implementation of ILockFile */ -class LockFile : public ComBaseObject, public ILockFile -{ -public: - SLANG_COM_BASE_IUNKNOWN_ALL - - // ICastable - SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) SLANG_OVERRIDE; - - // ILockFile - SLANG_NO_THROW const char* SLANG_MCALL getPath() SLANG_OVERRIDE; - SLANG_NO_THROW ISlangMutableFileSystem* SLANG_MCALL getFileSystem() SLANG_OVERRIDE; - SLANG_NO_THROW void SLANG_MCALL disown() SLANG_OVERRIDE; - - /// Ctor - LockFile(String path, ISlangMutableFileSystem* fileSystem) : - m_path(path), - m_fileSystem(fileSystem) - { - } - - ~LockFile(); - -protected: - void* getInterface(const Guid& uuid); - void* getObject(const Guid& uuid); - - ISlangMutableFileSystem* _getFileSystem(); - - String m_path; - ComPtr<ISlangMutableFileSystem> m_fileSystem; -}; - -/* -A representation of an artifact that is held in a file */ +/* A representation of an artifact that is held in a file */ class FileArtifactRepresentation : public ComBaseObject, public IFileArtifactRepresentation { public: @@ -64,10 +30,11 @@ public: // IFileArtifactRepresentation virtual SLANG_NO_THROW Kind SLANG_MCALL getKind() SLANG_OVERRIDE { return m_kind; } virtual SLANG_NO_THROW const char* SLANG_MCALL getPath() SLANG_OVERRIDE { return m_path.getBuffer(); } - virtual SLANG_NO_THROW ILockFile* SLANG_MCALL getLockFile() SLANG_OVERRIDE { return m_lockFile; } virtual SLANG_NO_THROW ISlangMutableFileSystem* SLANG_MCALL getFileSystem() SLANG_OVERRIDE { return m_fileSystem; } + virtual SLANG_NO_THROW void SLANG_MCALL disown() SLANG_OVERRIDE; + virtual SLANG_NO_THROW IFileArtifactRepresentation* SLANG_MCALL getLockFile() SLANG_OVERRIDE { return m_lockFile; } - FileArtifactRepresentation(Kind kind, String path, ILockFile* lockFile, ISlangMutableFileSystem* fileSystem): + FileArtifactRepresentation(Kind kind, String path, IFileArtifactRepresentation* lockFile, ISlangMutableFileSystem* fileSystem): m_kind(kind), m_path(path), m_lockFile(lockFile), @@ -81,11 +48,14 @@ protected: void* getInterface(const Guid& uuid); void* getObject(const Guid& uuid); + /// True if the file is owned + bool _isOwned() const { return Index(m_kind) >= Index(Kind::Owned); } + ISlangMutableFileSystem* _getFileSystem(); Kind m_kind; String m_path; - ComPtr<ILockFile> m_lockFile; + ComPtr<IFileArtifactRepresentation> m_lockFile; ComPtr<ISlangMutableFileSystem> m_fileSystem; }; |
