summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-modifier.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-09-28 18:07:40 -0700
committerGitHub <noreply@github.com>2023-09-28 18:07:40 -0700
commitb7d318f48db2cb83a41d665f1727ae93fc555124 (patch)
treed81d69cbba264cd059bbe67f29235226032c4793 /source/slang/slang-ast-modifier.h
parente7238942ea003e134b325fa65296df8e19368e90 (diff)
Support `constref` parameters passing. (#3249)
* Support `constref` parameters passing. * Fix. * Fix. * Add test and diagnostic on mix use of __constref and no_diff. * check for [constref] on differentiable member method. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-modifier.h')
-rw-r--r--source/slang/slang-ast-modifier.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ast-modifier.h b/source/slang/slang-ast-modifier.h
index af5823db4..68824b931 100644
--- a/source/slang/slang-ast-modifier.h
+++ b/source/slang/slang-ast-modifier.h
@@ -161,6 +161,11 @@ class RefModifier : public Modifier
SLANG_AST_CLASS(RefModifier)
};
+// `__ref` modifier for by-reference parameter passing
+class ConstRefModifier : public Modifier
+{
+ SLANG_AST_CLASS(ConstRefModifier)
+};
// This is a special sentinel modifier that gets added
// to the list when we have multiple variable declarations
@@ -919,6 +924,14 @@ class NonmutatingAttribute : public Attribute
SLANG_AST_CLASS(NonmutatingAttribute)
};
+// A `[constref]` attribute, which indicates that the `this` parameter of
+// a member function should be passed by reference.
+//
+class ConstRefAttribute : public Attribute
+{
+ SLANG_AST_CLASS(ConstRefAttribute)
+};
+
// A `[__readNone]` attribute, which indicates that a function
// computes its results strictly based on argument values, without