diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 59369fba2e772..0e9e471e8e7a0 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -147,24 +147,27 @@ bool QualType::isConstant(QualType T, const ASTContext &Ctx) { } std::optional -QualType::isNonConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, - bool ExcludeDtor) { - if (!isConstant(Ctx) && !(*this)->isReferenceType()) - return NonConstantStorageReason::NonConstNonReferenceType; - if (!Ctx.getLangOpts().CPlusPlus) - return std::nullopt; - if (const CXXRecordDecl *Record = - Ctx.getBaseElementType(*this)->getAsCXXRecordDecl()) { - if (!ExcludeCtor) - return NonConstantStorageReason::NonTrivialCtor; - if (Record->hasMutableFields()) - return NonConstantStorageReason::MutableField; - if (!Record->hasTrivialDestructor() && !ExcludeDtor) - return NonConstantStorageReason::NonTrivialDtor; - } - return std::nullopt; +QualType::isNonConstantStorage( const ASTContext &Ctx, bool ExcludeCtor, + bool ExcludeDtor ) +{ +if ( !isConstant( Ctx ) && !(*this)->isReferenceType() ) +return NonConstantStorageReason::NonConstNonReferenceType; +if ( !Ctx.getLangOpts().CPlusPlus ) +return std::nullopt; +if ( const CXXRecordDecl *Record = +Ctx.getBaseElementType( *this )->getAsCXXRecordDecl() ) +{ +if ( !ExcludeCtor ) +return NonConstantStorageReason::NonTrivialCtor; +if ( Record->hasMutableFields() ) +return NonConstantStorageReason::MutableField; +if ( !Record->hasTrivialDestructor() && !ExcludeDtor ) +return NonConstantStorageReason::NonTrivialDtor; +} +return std::nullopt; } + // C++ [temp.dep.type]p1: // A type is dependent if it is... // - an array type constructed from any dependent type or whose