aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-11 17:54:53 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-11 18:47:29 +0300
commitd00da05ecbeca36e8ca25dcb1238bf98b38081a5 (patch)
tree3c47892fb4a3485ba7a3400a523729b16484646b /src/type.zig
parent3ceb27c8401df17e5a7f522d68104da79501b5b6 (diff)
downloadzig-d00da05ecbeca36e8ca25dcb1238bf98b38081a5.tar.gz
zig-d00da05ecbeca36e8ca25dcb1238bf98b38081a5.zip
Sema: validate extern types
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig
index f14ad3a85b..765f1da18c 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -3935,7 +3935,6 @@ pub const Type = extern union {
/// Returns true if the type is optional and would be lowered to a single pointer
/// address value, using 0 for null. Note that this returns true for C pointers.
- /// See also `hasOptionalRepr`.
pub fn isPtrLikeOptional(self: Type) bool {
switch (self.tag()) {
.optional_single_const_pointer,
@@ -4631,6 +4630,14 @@ pub const Type = extern union {
}
/// Asserts the type is a function.
+ pub fn fnCallingConventionAllowsZigTypes(self: Type) bool {
+ return switch (self.fnCallingConvention()) {
+ .Unspecified, .Async, .Inline, .PtxKernel => true,
+ else => false,
+ };
+ }
+
+ /// Asserts the type is a function.
pub fn fnIsVarArgs(self: Type) bool {
return switch (self.tag()) {
.fn_noreturn_no_args => false,