summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-specialize-dispatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-specialize-dispatch.cpp')
-rw-r--r--source/slang/slang-ir-specialize-dispatch.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/source/slang/slang-ir-specialize-dispatch.cpp b/source/slang/slang-ir-specialize-dispatch.cpp
index e4d1af93a..0c8b248b0 100644
--- a/source/slang/slang-ir-specialize-dispatch.cpp
+++ b/source/slang/slang-ir-specialize-dispatch.cpp
@@ -232,23 +232,31 @@ void ensureWitnessTableSequentialIDs(SharedGenericsLoweringContext* sharedContex
{
auto interfaceType =
cast<IRWitnessTableType>(inst->getDataType())->getConformanceType();
- auto interfaceLinkage = interfaceType->findDecoration<IRLinkageDecoration>();
- SLANG_ASSERT(
- interfaceLinkage && "An interface type does not have a linkage,"
- "but a witness table associated with it has one.");
- auto interfaceName = interfaceLinkage->getMangledName();
- auto idAllocator =
- linkage->mapInterfaceMangledNameToSequentialIDCounters.tryGetValue(
- interfaceName);
- if (!idAllocator)
+ if (as<IRInterfaceType>(interfaceType))
{
- linkage->mapInterfaceMangledNameToSequentialIDCounters[interfaceName] = 0;
- idAllocator =
+ auto interfaceLinkage = interfaceType->findDecoration<IRLinkageDecoration>();
+ SLANG_ASSERT(
+ interfaceLinkage && "An interface type does not have a linkage,"
+ "but a witness table associated with it has one.");
+ auto interfaceName = interfaceLinkage->getMangledName();
+ auto idAllocator =
linkage->mapInterfaceMangledNameToSequentialIDCounters.tryGetValue(
interfaceName);
+ if (!idAllocator)
+ {
+ linkage->mapInterfaceMangledNameToSequentialIDCounters[interfaceName] = 0;
+ idAllocator =
+ linkage->mapInterfaceMangledNameToSequentialIDCounters.tryGetValue(
+ interfaceName);
+ }
+ seqID = *idAllocator;
+ ++(*idAllocator);
+ }
+ else
+ {
+ // NoneWitness, has special ID of -1.
+ seqID = uint32_t(-1);
}
- seqID = *idAllocator;
- ++(*idAllocator);
linkage->mapMangledNameToRTTIObjectIndex[witnessTableMangledName] = seqID;
}