summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-04-12 15:23:53 -0700
committerGitHub <noreply@github.com>2022-04-12 15:23:53 -0700
commit65c2e7f1ccc6cdb5daec343c7e32b4a9dc463ae4 (patch)
treeb13a93f5fa621a50ce3c100f018730c882ca3e9c /source/slang/slang-lower-to-ir.cpp
parent89560d62f3fb42e0f76cbae76c23eac437b65eba (diff)
Support `[DllImport]` (#2181)
* Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index bca8bd5b6..6cdf20af4 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -1051,6 +1051,11 @@ static void addLinkageDecoration(
{
builder->addExternCppDecoration(inst, mangledName);
}
+ if (auto dllImportModifier = decl->findModifier<DllImportAttribute>())
+ {
+ auto libraryName = dllImportModifier->modulePath;
+ builder->addDllImportDecoration(inst, libraryName.getUnownedSlice(), decl->getName()->text.getUnownedSlice());
+ }
}
static void addLinkageDecoration(
@@ -3173,6 +3178,11 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
return LoweredValInfo::simple(context->irBuilder->getBoolValue(expr->value));
}
+ LoweredValInfo visitNullPtrLiteralExpr(NullPtrLiteralExpr*)
+ {
+ return LoweredValInfo::simple(context->irBuilder->getPtrValue(nullptr));
+ }
+
LoweredValInfo visitIntegerLiteralExpr(IntegerLiteralExpr* expr)
{
auto type = lowerType(context, expr->type);