From eda9dd33647b271dd5ea5256e87cb23ad269b19f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 12 Apr 2023 12:06:41 -0400 Subject: Artifact Container (#2783) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP simplifying artifact interface. * Use ContainedKind. * Remove LazyCastableList. Use ContainedKind for find. * Remove ICastableList. * Remove need for ICastableList. * Remove IArtifactContainer. * Small fixes. * Small improvements around Artifact. * Make explicit find is for *representations* that can cast. Fix bug in handling casting in lookup. * Made associated items artifacts too. * Small fixes. * Small improvements around writing a container. * WIP artifact container format. * Make the root a special case. * Special case if the artifact doesn't have children/associated. --- source/compiler-core/slang-artifact-util.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/compiler-core/slang-artifact-util.cpp') diff --git a/source/compiler-core/slang-artifact-util.cpp b/source/compiler-core/slang-artifact-util.cpp index 1a920ff18..00884c96f 100644 --- a/source/compiler-core/slang-artifact-util.cpp +++ b/source/compiler-core/slang-artifact-util.cpp @@ -47,12 +47,13 @@ static bool _checkRecursive(ArtifactUtil::FindStyle findStyle) return createArtifact(desc); } -/* static */bool ArtifactUtil::isSignificant(IArtifact* artifact, void* data) +/* static */bool ArtifactUtil::isSignificant(IArtifact* artifact) { - SLANG_UNUSED(data); - - const auto desc = artifact->getDesc(); + return isSignificant(artifact->getDesc()); +} +/* static */bool ArtifactUtil::isSignificant(const ArtifactDesc& desc) +{ // Containers are not significant as of themselves, they may contain something tho if (isDerivedFrom(desc.kind, ArtifactKind::Container)) { @@ -85,6 +86,13 @@ static bool _checkRecursive(ArtifactUtil::FindStyle findStyle) return true; } + +/* static */bool ArtifactUtil::isSignificant(IArtifact* artifact, void* data) +{ + SLANG_UNUSED(data); + return isSignificant(artifact->getDesc()); +} + /* static */IArtifact* ArtifactUtil::findSignificant(IArtifact* artifact) { return findArtifactByPredicate(artifact, FindStyle::SelfOrChildren, &ArtifactUtil::isSignificant, nullptr); -- cgit v1.2.3