Skip to content

Commit fe5309d

Browse files
committed
Assert that we have a valid ConstantExpr in getBitWidthValue()
1 parent 90929a2 commit fe5309d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4601,6 +4601,8 @@ void FieldDecl::setLazyInClassInitializer(LazyDeclStmtPtr NewInit) {
46014601

46024602
unsigned FieldDecl::getBitWidthValue() const {
46034603
assert(isBitField() && "not a bitfield");
4604+
assert(isa<ConstantExpr>(getBitWidth()));
4605+
assert(cast<ConstantExpr>(getBitWidth())->hasAPValueResult());
46044606
return cast<ConstantExpr>(getBitWidth())
46054607
->getAPValueResult()
46064608
.getInt()

0 commit comments

Comments
 (0)