summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Yao <kyao@nvidia.com>2021-10-07 23:38:50 -0700
committerGitHub <noreply@github.com>2021-10-07 23:38:50 -0700
commit5b13b57fe600724344c556fe4309a5d6bb3d39ab (patch)
treefc00a76df49e0a95a09d0ac0225879b4e391f15b
parent112e1515c30fa972ff56f91514b70946153c718c (diff)
Return diagnostics data when encountering module load error by exception (#1966)
-rw-r--r--source/slang/slang.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 6fe778435..996b539ee 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -825,11 +825,11 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModule(
const char* moduleName,
slang::IBlob** outDiagnostics)
{
+ DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer);
try
{
auto name = getNamePool()->getName(moduleName);
- DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer);
auto module = findOrImportModule(name, SourceLoc(), &sink);
sink.getBlobIfNeeded(outDiagnostics);
@@ -838,6 +838,7 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModule(
}
catch (const AbortCompilationException&)
{
+ sink.getBlobIfNeeded(outDiagnostics);
return nullptr;
}
}