diff options
author | Timm Bäder <tbaeder@redhat.com> | 2023-12-19 14:25:47 +0100 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2023-12-19 14:47:48 +0100 |
commit | 6905438204b194973b6d6e56ddfe787ee4ce1e2d (patch) | |
tree | 88d1ad83cf70484885ac303d24a1570f2f870fa3 | |
parent | 32aa7d823c8ae7183e65da2f29ed08a84d6a1b6b (diff) | |
download | llvm-6905438204b194973b6d6e56ddfe787ee4ce1e2d.zip llvm-6905438204b194973b6d6e56ddfe787ee4ce1e2d.tar.gz llvm-6905438204b194973b6d6e56ddfe787ee4ce1e2d.tar.bz2 |
[clang][Sema][NFC] Simplify ActOnCXXThrow
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 081b568..4ae0435 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -843,21 +843,21 @@ Sema::ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *Ex) { // operation from the operand to the exception object (15.1) can be // omitted by constructing the automatic object directly into the // exception object - if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens())) - if (VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) { - if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) { - for( ; S; S = S->getParent()) { - if (S->isDeclScope(Var)) { - IsThrownVarInScope = true; - break; - } - - // FIXME: Many of the scope checks here seem incorrect. - if (S->getFlags() & - (Scope::FnScope | Scope::ClassScope | Scope::BlockScope | - Scope::ObjCMethodScope | Scope::TryScope)) - break; + if (const auto *DRE = dyn_cast<DeclRefExpr>(Ex->IgnoreParens())) + if (const auto *Var = dyn_cast<VarDecl>(DRE->getDecl()); + Var && Var->hasLocalStorage() && + !Var->getType().isVolatileQualified()) { + for (; S; S = S->getParent()) { + if (S->isDeclScope(Var)) { + IsThrownVarInScope = true; + break; } + + // FIXME: Many of the scope checks here seem incorrect. + if (S->getFlags() & + (Scope::FnScope | Scope::ClassScope | Scope::BlockScope | + Scope::ObjCMethodScope | Scope::TryScope)) + break; } } } |