From 4bd3e6e02324f913e8927fe69d32c0aafe9fc831 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 22 Aug 2022 14:17:56 -0700 Subject: Make Optional lower to PointerType instead of a struct. (#2373) --- source/slang/slang-ir-util.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/slang/slang-ir-util.cpp') diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index d91252fcc..7775fdb91 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -1,4 +1,5 @@ #include "slang-ir-util.h" +#include "slang-ir-insts.h" namespace Slang { @@ -43,4 +44,24 @@ bool isPtrToArrayType(IRInst* type) return isPointerOfType(type, kIROp_ArrayType) || isPointerOfType(type, kIROp_UnsizedArrayType); } + +bool isComInterfaceType(IRType* type) +{ + if (!type) return false; + if (type->findDecoration() || + type->getOp() == kIROp_ComPtrType) + { + return true; + } + + if (auto ptrType = as(type)) + { + auto valueType = ptrType->getValueType(); + return valueType->findDecoration() != nullptr; + } + + return false; +} + + } -- cgit v1.2.3