Skip to content

Commit 58b9564

Browse files
committed
[clang][Interp][NFC] Add some assertions
Make sure we pass a non-null Descriptor when creating a new Block.
1 parent 3aae916 commit 58b9564

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

clang/lib/AST/Interp/InterpBlock.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ class Block final {
5151
/// Creates a new block.
5252
Block(const std::optional<unsigned> &DeclID, const Descriptor *Desc,
5353
bool IsStatic = false, bool IsExtern = false)
54-
: DeclID(DeclID), IsStatic(IsStatic), IsExtern(IsExtern), Desc(Desc) {}
54+
: DeclID(DeclID), IsStatic(IsStatic), IsExtern(IsExtern), Desc(Desc) {
55+
assert(Desc);
56+
}
5557

5658
Block(const Descriptor *Desc, bool IsStatic = false, bool IsExtern = false)
5759
: DeclID((unsigned)-1), IsStatic(IsStatic), IsExtern(IsExtern),
58-
Desc(Desc) {}
60+
Desc(Desc) {
61+
assert(Desc);
62+
}
5963

6064
/// Returns the block's descriptor.
6165
const Descriptor *getDescriptor() const { return Desc; }

0 commit comments

Comments
 (0)