Skip to content

Commit 7271681

Browse files
[CFIFixup] Add a default constructor to BlockFlags (NFC) (#125296)
This patch adds a default constructor to BlockFlags to initialize its members to false, placing initializers close to the member declarations. Note that once C++20 is available in our codebase, we can replace the explicit default constructor with: bool Reachable : 1 = true; :
1 parent 6e7213b commit 7271681

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/CodeGen/CFIFixup.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ struct BlockFlags {
131131
bool StrongNoFrameOnEntry : 1;
132132
bool HasFrameOnEntry : 1;
133133
bool HasFrameOnExit : 1;
134+
BlockFlags()
135+
: Reachable(false), StrongNoFrameOnEntry(false), HasFrameOnEntry(false),
136+
HasFrameOnExit(false) {}
134137
};
135138

136139
// Most functions will have <= 32 basic blocks.
@@ -141,7 +144,7 @@ using BlockFlagsVector = SmallVector<BlockFlags, 32>;
141144
static BlockFlagsVector
142145
computeBlockInfo(const MachineFunction &MF,
143146
const MachineBasicBlock *PrologueBlock) {
144-
BlockFlagsVector BlockInfo(MF.getNumBlockIDs(), {false, false, false, false});
147+
BlockFlagsVector BlockInfo(MF.getNumBlockIDs());
145148
BlockInfo[0].Reachable = true;
146149
BlockInfo[0].StrongNoFrameOnEntry = true;
147150

0 commit comments

Comments
 (0)