Skip to content

Commit 6905438

Browse files
committed
[clang][Sema][NFC] Simplify ActOnCXXThrow
1 parent 32aa7d8 commit 6905438

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -843,21 +843,21 @@ Sema::ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *Ex) {
843843
// operation from the operand to the exception object (15.1) can be
844844
// omitted by constructing the automatic object directly into the
845845
// exception object
846-
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens()))
847-
if (VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
848-
if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) {
849-
for( ; S; S = S->getParent()) {
850-
if (S->isDeclScope(Var)) {
851-
IsThrownVarInScope = true;
852-
break;
853-
}
854-
855-
// FIXME: Many of the scope checks here seem incorrect.
856-
if (S->getFlags() &
857-
(Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
858-
Scope::ObjCMethodScope | Scope::TryScope))
859-
break;
846+
if (const auto *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens()))
847+
if (const auto *Var = dyn_cast<VarDecl>(DRE->getDecl());
848+
Var && Var->hasLocalStorage() &&
849+
!Var->getType().isVolatileQualified()) {
850+
for (; S; S = S->getParent()) {
851+
if (S->isDeclScope(Var)) {
852+
IsThrownVarInScope = true;
853+
break;
860854
}
855+
856+
// FIXME: Many of the scope checks here seem incorrect.
857+
if (S->getFlags() &
858+
(Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
859+
Scope::ObjCMethodScope | Scope::TryScope))
860+
break;
861861
}
862862
}
863863
}

0 commit comments

Comments
 (0)