diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-05-22 22:10:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-22 22:10:42 +0300 |
| commit | ce238dd878038bf857968931773cc9b10f3b225d (patch) | |
| tree | 2e29a5191fff5eb85a5a7895fd68b7b285bcb198 /source/slang/slang-mangle.cpp | |
| parent | 27c6e9b01f7386263bde90e16812be46327015c2 (diff) | |
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>
Diffstat (limited to 'source/slang/slang-mangle.cpp')
| -rw-r--r-- | source/slang/slang-mangle.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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<SizeOfIntVal>(val)) + { + emitRaw(context, "KSO"); + emitVal(context, sizeOfIntVal->getTypeArg()); + } + else if (auto alignOfIntVal = dynamicCast<AlignOfIntVal>(val)) + { + emitRaw(context, "KAO"); + emitVal(context, alignOfIntVal->getTypeArg()); + } + else if (auto countOfIntVal = dynamicCast<CountOfIntVal>(val)) + { + emitRaw(context, "KCO"); + emitVal(context, countOfIntVal->getTypeArg()); + } else if (const auto polynomialIntVal = dynamicCast<PolynomialIntVal>(val)) { emitRaw(context, "KX"); |
