From ce238dd878038bf857968931773cc9b10f3b225d Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Thu, 22 May 2025 22:10:42 +0300 Subject: Make sizeof(T) & alignof(T) of generic types work as compile-time constants (#7213) * Make sizeof(generic) work as compile-time constant * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang/slang-mangle.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/slang/slang-mangle.cpp') diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index 056c7accb..ea620ebb2 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -357,6 +357,21 @@ void emitVal(ManglingContext* context, Val* val) emitVal(context, lookupIntVal->getWitness()); emitName(context, lookupIntVal->getKey()->getName()); } + else if (auto sizeOfIntVal = dynamicCast(val)) + { + emitRaw(context, "KSO"); + emitVal(context, sizeOfIntVal->getTypeArg()); + } + else if (auto alignOfIntVal = dynamicCast(val)) + { + emitRaw(context, "KAO"); + emitVal(context, alignOfIntVal->getTypeArg()); + } + else if (auto countOfIntVal = dynamicCast(val)) + { + emitRaw(context, "KCO"); + emitVal(context, countOfIntVal->getTypeArg()); + } else if (const auto polynomialIntVal = dynamicCast(val)) { emitRaw(context, "KX"); -- cgit v1.2.3