summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-26 18:28:08 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-26 18:28:08 +0000
commitb2e31e4443ac168c056c908588e4ad768718d47e (patch)
treee52ff14b30adee5efe64c79b02e0f27be3288c73 /clang
parent1a1531d65ee5dc9e025be69ab35ca0406a0c6ea0 (diff)
downloadbcm5719-llvm-b2e31e4443ac168c056c908588e4ad768718d47e.tar.gz
bcm5719-llvm-b2e31e4443ac168c056c908588e4ad768718d47e.zip
Change HasMutableFields to HasOnlyCMembers and consider that a tag inside
another tag does not break C-like-ness. rdar://10756831 llvm-svn: 149071
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclCXX.h2
-rw-r--r--clang/lib/AST/DeclCXX.cpp11
2 files changed, 8 insertions, 5 deletions
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index e035e0b2fc0..dcc780781b3 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/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/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 6db3efcd184..afd23f66a35 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud