From 79ec0cfdb5f3461c763e0bf712cf42eb87fccb90 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 10 Dec 2019 10:02:19 -0500 Subject: DownstreamCompiler abstraction (#1149) * CPPCompiler -> DownstreamCompiler * Added DownstreamCompileResult to start abstraction such that we don't need files. * * Split out slang-blob.cpp * Made CompileResult hold a DownstreamCompileResult - for access to binary or ISlangSharedLibrary * Keep temporary files in scope. * Add a hash to the hex dump stream. * Move all file tracking into DownstreamCompiler. --- source/core/slang-io.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/core/slang-io.h') diff --git a/source/core/slang-io.h b/source/core/slang-io.h index 758a05edb..a42a6991b 100644 --- a/source/core/slang-io.h +++ b/source/core/slang-io.h @@ -91,8 +91,12 @@ namespace Slang }; // Helper class to clean up temporary files on dtor - struct TemporaryFileSet + class TemporaryFileSet: public RefObject { + public: + typedef RefObject Super; + typedef TemporaryFileSet ThisType; + void remove(const String& path) { if (const Index index = m_paths.indexOf(path) >= 0) @@ -119,6 +123,12 @@ namespace Slang { m_paths.clear(); } + + void swapWith(ThisType& rhs) + { + m_paths.swapWith(rhs.m_paths); + } + ~TemporaryFileSet() { for (const auto& path : m_paths) @@ -126,7 +136,15 @@ namespace Slang File::remove(path); } } + /// Default Ctor + TemporaryFileSet() {} + List m_paths; + + private: + // Disable ctor/assignment + TemporaryFileSet(const ThisType& rhs) = delete; + void operator=(const ThisType& rhs) = delete; }; } -- cgit v1.2.3