diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-09-10 16:31:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-10 13:31:26 -0700 |
| commit | 27ce5eb0de9f792f3e433bcb239c07d79371cf45 (patch) | |
| tree | bb85155ceafd280a3931432141fc1cc1dae20959 /source/compiler-core/slang-downstream-compiler.h | |
| parent | 28adf8917e53953dbfebd746410a427a55eed814 (diff) | |
First Slang LLVM integration (#1934)
* #include an absolute path didn't work - because paths were taken to always be relative.
* First integration with 'slang-llvm'.
* Fix project.
* Fix test output.
* First pass assert support.
* Add inline impls for min and max.
* Add abs inline abs impl for llvm.
* Make abs not use ternary op
* Fix typo in slang-llvm.h
* Sundary fixes to make remaining tests using llvm backend pass.
Diffstat (limited to 'source/compiler-core/slang-downstream-compiler.h')
| -rw-r--r-- | source/compiler-core/slang-downstream-compiler.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/source/compiler-core/slang-downstream-compiler.h b/source/compiler-core/slang-downstream-compiler.h index 861960f10..ed932a5c9 100644 --- a/source/compiler-core/slang-downstream-compiler.h +++ b/source/compiler-core/slang-downstream-compiler.h @@ -82,6 +82,9 @@ struct DownstreamDiagnostics /// Reset to an initial empty state void reset() { diagnostics.clear(); rawDiagnostics = String(); result = SLANG_OK; } + /// Count the number of diagnostics which have 'severity' or greater + Index getCountAtLeastSeverity(Diagnostic::Severity severity) const; + /// Get the number of diagnostics by severity Index getCountBySeverity(Diagnostic::Severity severity) const; /// True if there are any diagnostics of severity @@ -108,7 +111,7 @@ struct DownstreamDiagnostics String rawDiagnostics; - SlangResult result; + SlangResult result = SLANG_OK; List<Diagnostic> diagnostics; }; @@ -203,9 +206,9 @@ public: /// Ctor explicit Desc(SlangPassThrough inType = SLANG_PASS_THROUGH_NONE, Int inMajorVersion = 0, Int inMinorVersion = 0):type(inType), majorVersion(inMajorVersion), minorVersion(inMinorVersion) {} - SlangPassThrough type; ///< The type of the compiler - Int majorVersion; ///< Major version (interpretation is type specific) - Int minorVersion; ///< Minor version + SlangPassThrough type; ///< The type of the compiler + Int majorVersion; ///< Major version (interpretation is type specific) + Int minorVersion; ///< Minor version (interpretation is type specific) }; enum class OptimizationLevel @@ -462,14 +465,33 @@ public: void clear() { m_compilers.clear(); } + bool hasSharedLibrary(ISlangSharedLibrary* lib); + void addSharedLibrary(ISlangSharedLibrary* lib); + + ~DownstreamCompilerSet() + { + // A compiler may be implemented in a shared library, so release all first. + m_compilers.clearAndDeallocate(); + for (auto& defaultCompiler : m_defaultCompilers) + { + defaultCompiler.setNull(); + } + + // Release any shared libraries + m_sharedLibraries.clearAndDeallocate(); + } + protected: Index _findIndex(const DownstreamCompiler::Desc& desc) const; + RefPtr<DownstreamCompiler> m_defaultCompilers[int(SLANG_SOURCE_LANGUAGE_COUNT_OF)]; // This could be a dictionary/map - but doing a linear search is going to be fine and it makes // somethings easier. List<RefPtr<DownstreamCompiler>> m_compilers; + + List<ComPtr<ISlangSharedLibrary>> m_sharedLibraries; }; typedef SlangResult (*DownstreamCompilerLocatorFunc)(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set); |
