r327434 - Serialize the NonTrivialToPrimitive* flags I added in r326307.
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 13 11:58:25 PDT 2018
Author: ahatanak
Date: Tue Mar 13 11:58:25 2018
New Revision: 327434
URL: http://llvm.org/viewvc/llvm-project?rev=327434&view=rev
Log:
Serialize the NonTrivialToPrimitive* flags I added in r326307.
rdar://problem/38421774
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/CodeGenObjC/strong-in-c-struct.m
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=327434&r1=327433&r2=327434&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Tue Mar 13 11:58:25 2018
@@ -3616,24 +3616,24 @@ public:
return NonTrivialToPrimitiveDefaultInitialize;
}
- void setNonTrivialToPrimitiveDefaultInitialize() {
- NonTrivialToPrimitiveDefaultInitialize = true;
+ void setNonTrivialToPrimitiveDefaultInitialize(bool V) {
+ NonTrivialToPrimitiveDefaultInitialize = V;
}
bool isNonTrivialToPrimitiveCopy() const {
return NonTrivialToPrimitiveCopy;
}
- void setNonTrivialToPrimitiveCopy() {
- NonTrivialToPrimitiveCopy = true;
+ void setNonTrivialToPrimitiveCopy(bool V) {
+ NonTrivialToPrimitiveCopy = V;
}
bool isNonTrivialToPrimitiveDestroy() const {
return NonTrivialToPrimitiveDestroy;
}
- void setNonTrivialToPrimitiveDestroy() {
- NonTrivialToPrimitiveDestroy = true;
+ void setNonTrivialToPrimitiveDestroy(bool V) {
+ NonTrivialToPrimitiveDestroy = V;
}
/// \brief Determines whether this declaration represents the
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=327434&r1=327433&r2=327434&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Mar 13 11:58:25 2018
@@ -15445,12 +15445,12 @@ void Sema::ActOnFields(Scope *S, SourceL
if (Record && !getLangOpts().CPlusPlus) {
QualType FT = FD->getType();
if (FT.isNonTrivialToPrimitiveDefaultInitialize())
- Record->setNonTrivialToPrimitiveDefaultInitialize();
+ Record->setNonTrivialToPrimitiveDefaultInitialize(true);
QualType::PrimitiveCopyKind PCK = FT.isNonTrivialToPrimitiveCopy();
if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
- Record->setNonTrivialToPrimitiveCopy();
+ Record->setNonTrivialToPrimitiveCopy(true);
if (FT.isDestructedType())
- Record->setNonTrivialToPrimitiveDestroy();
+ Record->setNonTrivialToPrimitiveDestroy(true);
}
if (Record && FD->getType().isVolatileQualified())
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=327434&r1=327433&r2=327434&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Mar 13 11:58:25 2018
@@ -739,6 +739,9 @@ ASTDeclReader::VisitRecordDeclImpl(Recor
RD->setAnonymousStructOrUnion(Record.readInt());
RD->setHasObjectMember(Record.readInt());
RD->setHasVolatileMember(Record.readInt());
+ RD->setNonTrivialToPrimitiveDefaultInitialize(Record.readInt());
+ RD->setNonTrivialToPrimitiveCopy(Record.readInt());
+ RD->setNonTrivialToPrimitiveDestroy(Record.readInt());
return Redecl;
}
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=327434&r1=327433&r2=327434&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Tue Mar 13 11:58:25 2018
@@ -465,6 +465,9 @@ void ASTDeclWriter::VisitRecordDecl(Reco
Record.push_back(D->isAnonymousStructOrUnion());
Record.push_back(D->hasObjectMember());
Record.push_back(D->hasVolatileMember());
+ Record.push_back(D->isNonTrivialToPrimitiveDefaultInitialize());
+ Record.push_back(D->isNonTrivialToPrimitiveCopy());
+ Record.push_back(D->isNonTrivialToPrimitiveDestroy());
if (D->getDeclContext() == D->getLexicalDeclContext() &&
!D->hasAttrs() &&
@@ -1899,6 +1902,14 @@ void ASTWriter::WriteDeclAbbrevs() {
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
+
+ // isNonTrivialToPrimitiveDefaultInitialize
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
+ // isNonTrivialToPrimitiveCopy
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
+ // isNonTrivialToPrimitiveDestroy
+ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
+
// DC
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
Modified: cfe/trunk/test/CodeGenObjC/strong-in-c-struct.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/strong-in-c-struct.m?rev=327434&r1=327433&r2=327434&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/strong-in-c-struct.m (original)
+++ cfe/trunk/test/CodeGenObjC/strong-in-c-struct.m Tue Mar 13 11:58:25 2018
@@ -1,4 +1,10 @@
-// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s
+
+// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -emit-pch -o %t %s
+// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -include-pch %t -emit-llvm -o - -DUSESTRUCT %s | FileCheck %s
+
+#ifndef HEADER
+#define HEADER
typedef void (^BlockTy)(void);
@@ -63,6 +69,10 @@ typedef struct {
volatile char i6;
} Bitfield1;
+#endif
+
+#ifdef USESTRUCT
+
StrongSmall getStrongSmall(void);
StrongOuter getStrongOuter(void);
void calleeStrongSmall(StrongSmall);
@@ -520,3 +530,5 @@ void test_copy_constructor_Bitfield0(Bit
void test_copy_constructor_Bitfield1(Bitfield1 *a) {
Bitfield1 t = *a;
}
+
+#endif /* USESTRUCT */
More information about the cfe-commits
mailing list