diff options
author | walkingeyerobot <mitch@thefoley.net> | 2023-05-17 13:11:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 17:11:20 +0000 |
commit | 9b34b968af67c0089d902e7fed63a30d7fbe000d (patch) | |
tree | 64387468894d7505785b4beb3dde902d00321a5b /src/analysis | |
parent | 071431bac6269ff8bcfa95194c94446314a2394d (diff) | |
download | binaryen-9b34b968af67c0089d902e7fed63a30d7fbe000d.tar.gz binaryen-9b34b968af67c0089d902e7fed63a30d7fbe000d.tar.bz2 binaryen-9b34b968af67c0089d902e7fed63a30d7fbe000d.zip |
avoid incomplete type in a vector (#5730)
Swap the order of struct declarations to avoid using an incomplete type in a vector.
In C++20, using std::vector with an incomplete type often becomes a build failure due to increased usage of constexpr for vector members.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/cfg.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/analysis/cfg.h b/src/analysis/cfg.h index 3b980f410..ba4d7a774 100644 --- a/src/analysis/cfg.h +++ b/src/analysis/cfg.h @@ -30,23 +30,7 @@ namespace wasm::analysis { -struct BasicBlock; - -struct CFG { - // Iterate through basic blocks. - using iterator = std::vector<BasicBlock>::const_iterator; - iterator begin() const { return blocks.cbegin(); } - iterator end() const { return blocks.cend(); } - size_t size() const { return blocks.size(); } - - static CFG fromFunction(Function* func); - - void print(std::ostream& os, Module* wasm = nullptr) const; - -private: - std::vector<BasicBlock> blocks; - friend BasicBlock; -}; +struct CFG; struct BasicBlock { using iterator = std::vector<Expression*>::const_iterator; @@ -72,6 +56,22 @@ private: friend CFG; }; +struct CFG { + // Iterate through basic blocks. + using iterator = std::vector<BasicBlock>::const_iterator; + iterator begin() const { return blocks.cbegin(); } + iterator end() const { return blocks.cend(); } + size_t size() const { return blocks.size(); } + + static CFG fromFunction(Function* func); + + void print(std::ostream& os, Module* wasm = nullptr) const; + +private: + std::vector<BasicBlock> blocks; + friend BasicBlock; +}; + } // namespace wasm::analysis #include "cfg-impl.h" |