diff options
author | Sergio Martins <smartins@kde.org> | 2021-07-27 21:44:38 +0100 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2021-07-27 21:44:38 +0100 |
commit | fabea1d1d42812915d550609f2695b74954c7cad (patch) | |
tree | 846e39435645fbed11048ef45fd55c5efbfd300d | |
parent | 8d024d594bfe7183d8aa5f9c8952709078f140a8 (diff) |
Minor styling: use auto when type is duplicated
-rw-r--r-- | src/checks/manuallevel/unexpected-flag-enumerator-value.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp index 0c918647..90d6dc43 100644 --- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp +++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp @@ -39,10 +39,9 @@ UnexpectedFlagEnumeratorValue::UnexpectedFlagEnumeratorValue(const std::string & static bool isIntentionallyNotPowerOf2(EnumConstantDecl *en) { - ConstantExpr *cexpr = dyn_cast_or_null<ConstantExpr>(clazy::getFirstChild(en->getInitExpr())); - if (!cexpr) { + auto cexpr = dyn_cast_or_null<ConstantExpr>(clazy::getFirstChild(en->getInitExpr())); + if (!cexpr) return false; - } if (auto binaryOp = dyn_cast_or_null<BinaryOperator>(cexpr->getSubExpr())) { binaryOp->dump(); @@ -108,10 +107,9 @@ static IsFlagEnumResult isFlagEnum(const SmallVector<EnumConstantDecl*, 16>& enu void UnexpectedFlagEnumeratorValue::VisitDecl(clang::Decl *decl) { - EnumDecl* enDecl = dyn_cast_or_null<EnumDecl>(decl); - if (!enDecl) { + auto enDecl = dyn_cast_or_null<EnumDecl>(decl); + if (!enDecl) return; - } const SmallVector<EnumConstantDecl*, 16> enumerators = getEnumerators(enDecl); |