[cfe-commits] r149071 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Jan 26 10:28:08 PST 2012


Author: akirtzidis
Date: Thu Jan 26 12:28:08 2012
New Revision: 149071

URL: http://llvm.org/viewvc/llvm-project?rev=149071&view=rev
Log:
Change HasMutableFields to HasOnlyCMembers and consider that a tag inside
another tag does not break C-like-ness. rdar://10756831

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=149071&r1=149070&r2=149071&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Jan 26 12:28:08 2012
@@ -349,7 +349,7 @@
     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.

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=149071&r1=149070&r2=149071&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Jan 26 12:28:08 2012
@@ -43,7 +43,7 @@
     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::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 @@
     return true;
 
   return isPOD() &&
-      data().HasOnlyFields &&
+      data().HasOnlyCMembers &&
       !data().HasPrivateFields &&
       !data().HasProtectedFields &&
       !data().NumBases;





More information about the cfe-commits mailing list