Assert pointer cannot be null; NFC

Klocwork static code analysis exposed this concern:
Pointer 'SubExpr' returned from call to getSubExpr() function which may
return NULL from 'cast_or_null<Expr>(Operand)', which will be
dereferenced in the statement following it

Add an assert on SubExpr to make it clear this pointer cannot be null.
This commit is contained in:
Sindhu Chittireddy 2021-08-26 06:58:56 -04:00 committed by Aaron Ballman
parent 9b830c798e
commit de15979bc3
1 changed files with 1 additions and 0 deletions

View File

@ -4348,6 +4348,7 @@ llvm::GlobalVariable *MicrosoftCXXABI::getThrowInfo(QualType T) {
void MicrosoftCXXABI::emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) {
const Expr *SubExpr = E->getSubExpr();
assert(SubExpr && "SubExpr cannot be null");
QualType ThrowType = SubExpr->getType();
// The exception object lives on the stack and it's address is passed to the
// runtime function.