r206493 - Add missing serialization code for one of the CXXRecordDecl definition flags.

Richard Smith richard-llvm at metafoo.co.uk
Thu Apr 17 13:33:02 PDT 2014


Author: rsmith
Date: Thu Apr 17 15:33:01 2014
New Revision: 206493

URL: http://llvm.org/viewvc/llvm-project?rev=206493&view=rev
Log:
Add missing serialization code for one of the CXXRecordDecl definition flags.

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/lib/Serialization/ASTWriter.cpp
    cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
    cfe/trunk/test/Modules/cxx-decls.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=206493&r1=206492&r2=206493&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Apr 17 15:33:01 2014
@@ -1199,6 +1199,7 @@ void ASTDeclReader::ReadCXXDefinitionDat
   Data.DefaultedMoveAssignmentIsDeleted = Record[Idx++];
   Data.DefaultedDestructorIsDeleted = Record[Idx++];
   Data.HasTrivialSpecialMembers = Record[Idx++];
+  Data.DeclaredNonTrivialSpecialMembers = Record[Idx++];
   Data.HasIrrelevantDestructor = Record[Idx++];
   Data.HasConstexprNonCopyMoveConstructor = Record[Idx++];
   Data.DefaultedDefaultConstructorIsConstexpr = Record[Idx++];

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=206493&r1=206492&r2=206493&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Thu Apr 17 15:33:01 2014
@@ -5248,6 +5248,7 @@ void ASTWriter::AddCXXDefinitionData(con
   Record.push_back(Data.DefaultedMoveAssignmentIsDeleted);
   Record.push_back(Data.DefaultedDestructorIsDeleted);
   Record.push_back(Data.HasTrivialSpecialMembers);
+  Record.push_back(Data.DeclaredNonTrivialSpecialMembers);
   Record.push_back(Data.HasIrrelevantDestructor);
   Record.push_back(Data.HasConstexprNonCopyMoveConstructor);
   Record.push_back(Data.DefaultedDefaultConstructorIsConstexpr);

Modified: cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h?rev=206493&r1=206492&r2=206493&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h Thu Apr 17 15:33:01 2014
@@ -3,3 +3,18 @@ class HasFriends {
   friend void friend_2(HasFriends);
   void private_thing();
 };
+
+struct HasNontrivialDefaultConstructor {
+  HasNontrivialDefaultConstructor() = default;
+  HasNontrivialDefaultConstructor(int n = 0);
+
+  // Ensure this class is not POD but is still trivially-copyable.
+  // This is necessary to exercise the second static_assert below,
+  // because GCC's spec for __has_trivial_constructor is absurd.
+  int m;
+private:
+  int n;
+};
+
+static_assert(!__is_trivial(HasNontrivialDefaultConstructor), "");
+static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), "");

Modified: cfe/trunk/test/Modules/cxx-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-decls.cpp?rev=206493&r1=206492&r2=206493&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-decls.cpp (original)
+++ cfe/trunk/test/Modules/cxx-decls.cpp Thu Apr 17 15:33:01 2014
@@ -19,3 +19,6 @@ void test_friends(HasFriends s) {
   friend_1(s);
   friend_2(s);
 }
+
+static_assert(!__is_trivial(HasNontrivialDefaultConstructor), "");
+static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), "");





More information about the cfe-commits mailing list