Skip to content

Commit 9b34b96

Browse files
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.
1 parent 071431b commit 9b34b96

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/analysis/cfg.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,7 @@
3030

3131
namespace wasm::analysis {
3232

33-
struct BasicBlock;
34-
35-
struct CFG {
36-
// Iterate through basic blocks.
37-
using iterator = std::vector<BasicBlock>::const_iterator;
38-
iterator begin() const { return blocks.cbegin(); }
39-
iterator end() const { return blocks.cend(); }
40-
size_t size() const { return blocks.size(); }
41-
42-
static CFG fromFunction(Function* func);
43-
44-
void print(std::ostream& os, Module* wasm = nullptr) const;
45-
46-
private:
47-
std::vector<BasicBlock> blocks;
48-
friend BasicBlock;
49-
};
33+
struct CFG;
5034

5135
struct BasicBlock {
5236
using iterator = std::vector<Expression*>::const_iterator;
@@ -72,6 +56,22 @@ struct BasicBlock {
7256
friend CFG;
7357
};
7458

59+
struct CFG {
60+
// Iterate through basic blocks.
61+
using iterator = std::vector<BasicBlock>::const_iterator;
62+
iterator begin() const { return blocks.cbegin(); }
63+
iterator end() const { return blocks.cend(); }
64+
size_t size() const { return blocks.size(); }
65+
66+
static CFG fromFunction(Function* func);
67+
68+
void print(std::ostream& os, Module* wasm = nullptr) const;
69+
70+
private:
71+
std::vector<BasicBlock> blocks;
72+
friend BasicBlock;
73+
};
74+
7575
} // namespace wasm::analysis
7676

7777
#include "cfg-impl.h"

0 commit comments

Comments
 (0)