-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ir: Handle NonZero and simplify Option<NonZero> like we simplify Opti…
…on<NonNull>. Fixes #646
- Loading branch information
Showing
12 changed files
with
541 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
|
||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct Option_Option_NonZeroI64 Option_Option_NonZeroI64; | ||
|
||
typedef struct NonZeroTest { | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const struct Option_Option_NonZeroI64 *j; | ||
} NonZeroTest; | ||
|
||
void root(struct NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const struct Option_Option_NonZeroI64 *j); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
|
||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct Option_Option_NonZeroI64 Option_Option_NonZeroI64; | ||
|
||
typedef struct NonZeroTest { | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const struct Option_Option_NonZeroI64 *j; | ||
} NonZeroTest; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void root(struct NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const struct Option_Option_NonZeroI64 *j); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
|
||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct Option_Option_NonZeroI64 Option_Option_NonZeroI64; | ||
|
||
typedef struct { | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const Option_Option_NonZeroI64 *j; | ||
} NonZeroTest; | ||
|
||
void root(NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const Option_Option_NonZeroI64 *j); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
|
||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct Option_Option_NonZeroI64 Option_Option_NonZeroI64; | ||
|
||
typedef struct { | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const Option_Option_NonZeroI64 *j; | ||
} NonZeroTest; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void root(NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const Option_Option_NonZeroI64 *j); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
|
||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
#include <cstdarg> | ||
#include <cstdint> | ||
#include <cstdlib> | ||
#include <ostream> | ||
#include <new> | ||
|
||
template<typename T = void> | ||
struct Option; | ||
|
||
struct NonZeroTest { | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const Option<Option<NonZeroI64>> *j; | ||
}; | ||
|
||
extern "C" { | ||
|
||
void root(NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const Option<Option<NonZeroI64>> *j); | ||
|
||
} // extern "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#if 0 | ||
''' ' | ||
#endif | ||
#ifdef __cplusplus | ||
struct NonZeroI64; | ||
#endif | ||
#if 0 | ||
' ''' | ||
#endif | ||
|
||
|
||
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t | ||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t | ||
cdef extern from *: | ||
ctypedef bint bool | ||
ctypedef struct va_list | ||
|
||
cdef extern from *: | ||
|
||
ctypedef struct Option_Option_NonZeroI64: | ||
pass | ||
|
||
ctypedef struct NonZeroTest: | ||
uint8_t a; | ||
uint16_t b; | ||
uint32_t c; | ||
uint64_t d; | ||
int8_t e; | ||
int16_t f; | ||
int32_t g; | ||
int64_t h; | ||
int64_t i; | ||
const Option_Option_NonZeroI64 *j; | ||
|
||
void root(NonZeroTest test, | ||
uint8_t a, | ||
uint16_t b, | ||
uint32_t c, | ||
uint64_t d, | ||
int8_t e, | ||
int16_t f, | ||
int32_t g, | ||
int64_t h, | ||
int64_t i, | ||
const Option_Option_NonZeroI64 *j); |
Oops, something went wrong.