summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-17 12:42:24 -0800
committerGitHub <noreply@github.com>2024-12-17 12:42:24 -0800
commit49e912a9d0d6ca5f762ec11cd8cb918f182eb76e (patch)
treeb8ca8c51fe248c6816dbc1569156a5cb477aade0 /source
parent7ffc69d9be19e844b43f4ba2ae286ece00ddb8c2 (diff)
Fix entrypoint auto discovery logic. (#5885)
* Fix entrypoint auto discovery logic. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 9e9b5fbe3..7d18cb50b 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -5171,22 +5171,24 @@ IArtifact* ComponentType::getTargetArtifact(Int targetIndex, slang::IBlob** outD
entryPointsDiscovered = true;
}
}
- // If no entry points were discovered, then we should return nullptr.
- if (!entryPointsDiscovered)
- {
- return nullptr;
- }
- RefPtr<CompositeComponentType> composite = new CompositeComponentType(linkage, components);
- ComPtr<IComponentType> linkedComponentType;
- SLANG_RETURN_NULL_ON_FAIL(composite->link(linkedComponentType.writeRef(), outDiagnostics));
- auto targetArtifact = static_cast<ComponentType*>(linkedComponentType.get())
- ->getTargetArtifact(targetIndex, outDiagnostics);
- if (targetArtifact)
+ // If any entry points were discovered, then we should emit the program with entrypoints
+ // linked.
+ if (entryPointsDiscovered)
{
- m_targetArtifacts[targetIndex] = targetArtifact;
+ RefPtr<CompositeComponentType> composite =
+ new CompositeComponentType(linkage, components);
+ ComPtr<IComponentType> linkedComponentType;
+ SLANG_RETURN_NULL_ON_FAIL(
+ composite->link(linkedComponentType.writeRef(), outDiagnostics));
+ auto targetArtifact = static_cast<ComponentType*>(linkedComponentType.get())
+ ->getTargetArtifact(targetIndex, outDiagnostics);
+ if (targetArtifact)
+ {
+ m_targetArtifacts[targetIndex] = targetArtifact;
+ }
+ return targetArtifact;
}
- return targetArtifact;
}
auto target = linkage->targets[targetIndex];