Author: majnemer Date: Sun May 22 00:34:26 2016 New Revision: 270353 URL: http://llvm.org/viewvc/llvm-project?rev=270353&view=rev Log: [AST] Cleanup comments regarding CXXRecordDecl::isEmpty
We were missing references to the standard, some of our home-grown verbiage didn't make any sense. No functional change is intended. Modified: cfe/trunk/include/clang/AST/DeclCXX.h cfe/trunk/lib/AST/DeclCXX.cpp Modified: cfe/trunk/include/clang/AST/DeclCXX.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=270353&r1=270352&r2=270353&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/DeclCXX.h (original) +++ cfe/trunk/include/clang/AST/DeclCXX.h Sun May 22 00:34:26 2016 @@ -1139,9 +1139,10 @@ public: /// \brief Determine whether this is an empty class in the sense of /// (C++11 [meta.unary.prop]). /// - /// A non-union class is empty iff it has a virtual function, virtual base, - /// data member (other than 0-width bit-field) or inherits from a non-empty - /// class. + /// The CXXRecordDecl is a class type, but not a union type, + /// with no non-static data members other than bit-fields of length 0, + /// no virtual member functions, no virtual base classes, + /// and no base class B for which is_empty<B>::value is false. /// /// \note This does NOT include a check for union-ness. bool isEmpty() const { return data().Empty; } Modified: cfe/trunk/lib/AST/DeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=270353&r1=270352&r2=270353&view=diff ============================================================================== --- cfe/trunk/lib/AST/DeclCXX.cpp (original) +++ cfe/trunk/lib/AST/DeclCXX.cpp Sun May 22 00:34:26 2016 @@ -172,8 +172,6 @@ CXXRecordDecl::setBases(CXXBaseSpecifier CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl()); - // A class with a non-empty base class is not empty. - // FIXME: Standard ref? if (!BaseClassDecl->isEmpty()) { if (!data().Empty) { // C++0x [class]p7: @@ -187,6 +185,9 @@ CXXRecordDecl::setBases(CXXBaseSpecifier data().IsStandardLayout = false; } + // C++14 [meta.unary.prop]p4: + // T is a class type [...] with [...] no base class B for which + // is_empty<B>::value is false. data().Empty = false; data().HasNoNonEmptyBases = false; } @@ -238,9 +239,9 @@ CXXRecordDecl::setBases(CXXBaseSpecifier if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second) VBases.push_back(Base); - // C++11 [meta.unary.prop] is_empty: - // T is a class type, but not a union type, with ... no virtual base - // classes + // C++14 [meta.unary.prop] is_empty: + // T is a class type, but not a union type, with ... no virtual base + // classes data().Empty = false; // C++1z [dcl.init.agg]p1: @@ -458,8 +459,8 @@ void CXXRecordDecl::addedMember(Decl *D) // A POD-struct is an aggregate class... data().PlainOldData = false; - // Virtual functions make the class non-empty. - // FIXME: Standard ref? + // C++14 [meta.unary.prop]p4: + // T is a class type [...] with [...] no virtual member functions... data().Empty = false; // C++ [class.virtual]p1: @@ -938,7 +939,9 @@ void CXXRecordDecl::addedMember(Decl *D) if (!data().HasNoNonEmptyBases) data().IsStandardLayout = false; - // If this is not a zero-length bit-field, then the class is not empty. + // C++14 [meta.unary.prop]p4: + // T is a class type [...] with [...] no non-static data members other + // than bit-fields of length 0... if (data().Empty) { if (!Field->isBitField() || (!Field->getBitWidth()->isTypeDependent() && _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits