diff options
author | ReinUsesLisp <[email protected]> | 2021-02-14 22:45:31 -0300 |
---|---|---|
committer | ReinUsesLisp <[email protected]> | 2021-02-14 22:45:31 -0300 |
commit | f819ade0efe925a782090dea9e1bf300fedffb39 (patch) | |
tree | 57c2f953099562d3dcd32d8a08af9e99fbdd9a4b /include | |
parent | c374bfd9fdff02a0cff85d005488967b1b0f675e (diff) | |
download | sirit-f819ade0efe925a782090dea9e1bf300fedffb39.tar.gz sirit-f819ade0efe925a782090dea9e1bf300fedffb39.zip |
Add support for forward declarations
Diffstat (limited to 'include')
-rw-r--r-- | include/sirit/sirit.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 0a204d7..b675650 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -35,6 +35,10 @@ struct Id { std::uint32_t value; }; +[[nodiscard]] inline bool ValidId(Id id) noexcept { + return id.value != 0; +} + class Module { public: explicit Module(std::uint32_t version = spv::Version); @@ -83,6 +87,12 @@ public: AddExecutionMode(entry_point, mode, std::span<const Literal>({literals...})); } + /// Generate a new id for forward declarations + [[nodiscard]] Id ForwardDeclarationId(); + + /// Assign a new id and return the old one, useful for defining forward declarations + Id ExchangeCurrentId(Id new_current_id); + /** * Adds an existing label to the code * @param label Label to insert into code. |