diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-26 18:28:08 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-01-26 18:28:08 +0000 |
commit | 4fe19b5bf0db0cbe6afa280ed9f52ed4cb631e53 (patch) | |
tree | fe5ab40c93a6a890f218bdb454aaa053dd590928 | |
parent | ed0cc2269b93508c51e3a31f3922ee2efea875b7 (diff) |
Change HasMutableFields to HasOnlyCMembers and consider that a tag inside
another tag does not break C-like-ness. rdar://10756831
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149071 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DeclCXX.h | 2 | ||||
-rw-r--r-- | lib/AST/DeclCXX.cpp | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index e035e0b2fc..dcc780781b 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -349,7 +349,7 @@ class CXXRecordDecl : public RecordDecl { bool HasMutableFields : 1; /// \brief True if there no non-field members declared by the user. - bool HasOnlyFields : 1; + bool HasOnlyCMembers : 1; /// HasTrivialDefaultConstructor - True when, if this class has a default /// constructor, this default constructor is trivial. diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 6db3efcd18..afd23f66a3 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -43,7 +43,7 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D) Aggregate(true), PlainOldData(true), Empty(true), Polymorphic(false), Abstract(false), IsStandardLayout(true), HasNoNonEmptyBases(true), HasPrivateFields(false), HasProtectedFields(false), HasPublicFields(false), - HasMutableFields(false), HasOnlyFields(true), + HasMutableFields(false), HasOnlyCMembers(true), HasTrivialDefaultConstructor(true), HasConstexprNonCopyMoveConstructor(false), DefaultedDefaultConstructorIsConstexpr(true), @@ -457,8 +457,11 @@ void CXXRecordDecl::markedVirtualFunctionPure() { } void CXXRecordDecl::addedMember(Decl *D) { - if (!isa<FieldDecl>(D) && !isa<IndirectFieldDecl>(D) && !D->isImplicit()) - data().HasOnlyFields = false; + if (!D->isImplicit() && + !isa<FieldDecl>(D) && + !isa<IndirectFieldDecl>(D) && + (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class)) + data().HasOnlyCMembers = false; // Ignore friends and invalid declarations. if (D->getFriendObjectKind() || D->isInvalidDecl()) @@ -968,7 +971,7 @@ bool CXXRecordDecl::isCLike() const { return true; return isPOD() && - data().HasOnlyFields && + data().HasOnlyCMembers && !data().HasPrivateFields && !data().HasProtectedFields && !data().NumBases; |