summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slang.h10
-rw-r--r--source/slang-capture-replay/slang-module.cpp16
-rw-r--r--source/slang-capture-replay/slang-module.h3
-rw-r--r--source/slang/slang-compiler.cpp12
-rwxr-xr-xsource/slang/slang-compiler.h9
5 files changed, 50 insertions, 0 deletions
diff --git a/slang.h b/slang.h
index cdd20f99b..d4c94a433 100644
--- a/slang.h
+++ b/slang.h
@@ -5028,6 +5028,16 @@ namespace slang
SlangStage stage,
IEntryPoint** outEntryPoint,
ISlangBlob** outDiagnostics) = 0;
+
+ /// Get the number of dependency files that this module depends on.
+ /// This includes both the explicit source files, as well as any
+ /// additional files that were transitively referenced (e.g., via
+ /// a `#include` directive).
+ virtual SLANG_NO_THROW SlangInt32 SLANG_MCALL getDependencyFileCount() = 0;
+
+ /// Get the path to a file this module depends on.
+ virtual SLANG_NO_THROW char const* SLANG_MCALL getDependencyFilePath(
+ SlangInt32 index) = 0;
};
#define SLANG_UUID_IModule IModule::getTypeGuid()
diff --git a/source/slang-capture-replay/slang-module.cpp b/source/slang-capture-replay/slang-module.cpp
index 0b5ed47f1..8a1a80126 100644
--- a/source/slang-capture-replay/slang-module.cpp
+++ b/source/slang-capture-replay/slang-module.cpp
@@ -189,6 +189,22 @@ namespace SlangCapture
return res;
}
+ SLANG_NO_THROW SlangInt32 ModuleCapture::getDependencyFileCount()
+ {
+ // No need to capture this call as it is just a query.
+ slangCaptureLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__);
+ SlangInt32 res = m_actualModule->getDependencyFileCount();
+ return res;
+ }
+
+ SLANG_NO_THROW char const* ModuleCapture::getDependencyFilePath(SlangInt32 index)
+ {
+ // No need to capture this call as it is just a query.
+ slangCaptureLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__);
+ const char* res = m_actualModule->getDependencyFilePath(index);
+ return res;
+ }
+
SLANG_NO_THROW slang::ISession* ModuleCapture::getSession()
{
slangCaptureLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__);
diff --git a/source/slang-capture-replay/slang-module.h b/source/slang-capture-replay/slang-module.h
index dd19a0b71..5243b8777 100644
--- a/source/slang-capture-replay/slang-module.h
+++ b/source/slang-capture-replay/slang-module.h
@@ -36,6 +36,9 @@ namespace SlangCapture
virtual SLANG_NO_THROW const char* SLANG_MCALL getUniqueIdentity() override;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL findAndCheckEntryPoint(
char const* name, SlangStage stage, slang::IEntryPoint** outEntryPoint, ISlangBlob** outDiagnostics) override;
+ virtual SLANG_NO_THROW SlangInt32 SLANG_MCALL getDependencyFileCount() override;
+ virtual SLANG_NO_THROW char const* SLANG_MCALL getDependencyFilePath(
+ SlangInt32 index) override;
// Interfaces for `IComponentType`
virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override;
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index cee104dc9..e61c0f220 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -2471,6 +2471,18 @@ namespace Slang
return nullptr;
}
+ SLANG_NO_THROW SlangInt32 SLANG_MCALL Module::getDependencyFileCount()
+ {
+ return (SlangInt32)getFileDependencies().getCount();
+ }
+
+ SLANG_NO_THROW char const* SLANG_MCALL Module::getDependencyFilePath(
+ SlangInt32 index)
+ {
+ SourceFile* sourceFile = getFileDependencies()[index];
+ return sourceFile->getPathInfo().hasFoundPath() ? sourceFile->getPathInfo().foundPath.getBuffer() : nullptr;
+ }
+
void validateEntryPoint(
EntryPoint* entryPoint,
DiagnosticSink* sink);
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 056e6ea21..46724119b 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -1453,6 +1453,15 @@ namespace Slang
/// Get the unique identity of the module.
virtual SLANG_NO_THROW const char* SLANG_MCALL getUniqueIdentity() override;
+ /// Get the number of dependency files that this module depends on.
+ /// This includes both the explicit source files, as well as any
+ /// additional files that were transitively referenced (e.g., via
+ /// a `#include` directive).
+ virtual SLANG_NO_THROW SlangInt32 SLANG_MCALL getDependencyFileCount() override;
+
+ /// Get the path to a file this module depends on.
+ virtual SLANG_NO_THROW char const* SLANG_MCALL getDependencyFilePath(
+ SlangInt32 index) override;
virtual void buildHash(DigestBuilder<SHA1>& builder) SLANG_OVERRIDE;