summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-22 14:17:56 -0700
committerGitHub <noreply@github.com>2022-08-22 14:17:56 -0700
commit4bd3e6e02324f913e8927fe69d32c0aafe9fc831 (patch)
tree1f6ff8449feb49d00dee2bc527f7dc531a07c196 /source/slang/slang-ir-util.cpp
parent393185196ed65a9eeaf9502edbf3dcce87337d81 (diff)
Make Optional<PointerType> lower to PointerType instead of a struct. (#2373)
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp21
1 files changed, 21 insertions, 0 deletions
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<IRComInterfaceDecoration>() ||
+ type->getOp() == kIROp_ComPtrType)
+ {
+ return true;
+ }
+
+ if (auto ptrType = as<IRNativePtrType>(type))
+ {
+ auto valueType = ptrType->getValueType();
+ return valueType->findDecoration<IRComInterfaceDecoration>() != nullptr;
+ }
+
+ return false;
+}
+
+
}