@@ -36,9 +36,7 @@ AST_MATCHER(EnumDecl, isCompleteAndHasNoZeroValue) {
3636// Find an initialization which initializes the value (if it has enum type) to a
3737// default zero value.
3838AST_MATCHER (Expr, isEmptyInit) {
39- if (isa<CXXScalarValueInitExpr>(&Node))
40- return true ;
41- if (isa<ImplicitValueInitExpr>(&Node))
39+ if (isa<CXXScalarValueInitExpr, ImplicitValueInitExpr>(&Node))
4240 return true ;
4341 if (const auto *Init = dyn_cast<InitListExpr>(&Node)) {
4442 if (Init->getNumInits () == 0 )
@@ -63,11 +61,9 @@ class FindEnumMember : public TypeVisitor<FindEnumMember, bool> {
6361 return Visit (DesT);
6462 return false ;
6563 }
66- bool VisitArrayType (const ArrayType *T) {
67- return Visit (T->getElementType ()->getUnqualifiedDesugaredType ());
68- }
64+ bool VisitArrayType (const ArrayType *T) { return Visit (T->getElementType ()); }
6965 bool VisitConstantArrayType (const ConstantArrayType *T) {
70- return Visit (T->getElementType ()-> getUnqualifiedDesugaredType () );
66+ return Visit (T->getElementType ());
7167 }
7268 bool VisitEnumType (const EnumType *T) {
7369 if (isCompleteAndHasNoZeroValue (T->getDecl ())) {
@@ -81,7 +77,7 @@ class FindEnumMember : public TypeVisitor<FindEnumMember, bool> {
8177 if (RD->isUnion ())
8278 return false ;
8379 auto VisitField = [this ](const FieldDecl *F) {
84- return Visit (F->getType ()-> getUnqualifiedDesugaredType () );
80+ return Visit (F->getType ());
8581 };
8682 return llvm::any_of (RD->fields (), VisitField);
8783 }
@@ -137,7 +133,7 @@ void InvalidEnumDefaultInitializationCheck::check(
137133 ASTContext &ACtx = Enum->getASTContext ();
138134 SourceLocation Loc = InitExpr->getExprLoc ();
139135 if (Loc.isInvalid ()) {
140- if (isa<ImplicitValueInitExpr>(InitExpr) || isa< InitListExpr>(InitExpr)) {
136+ if (isa<ImplicitValueInitExpr, InitListExpr>(InitExpr)) {
141137 DynTypedNodeList Parents = ACtx.getParents (*InitExpr);
142138 if (Parents.empty ())
143139 return ;
0 commit comments