Skip to content

Commit b2d2cf0

Browse files
authored
Merge pull request #33252 from zoecarver/cxx/rename-is-cxx-non-trivial
2 parents 9b33ffa + 6e4e478 commit b2d2cf0

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

include/swift/AST/Decl.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -557,14 +557,14 @@ class alignas(1 << DeclAlignInBits) Decl {
557557
IsIncompatibleWithWeakReferences : 1
558558
);
559559

560-
SWIFT_INLINE_BITFIELD(StructDecl, NominalTypeDecl, 1+1,
561-
/// True if this struct has storage for fields that aren't accessible in
562-
/// Swift.
563-
HasUnreferenceableStorage : 1,
564-
/// True if this struct is imported from C++ and not trivially copyable.
565-
IsCxxNotTriviallyCopyable : 1
566-
);
567-
560+
SWIFT_INLINE_BITFIELD(
561+
StructDecl, NominalTypeDecl, 1 + 1,
562+
/// True if this struct has storage for fields that aren't accessible in
563+
/// Swift.
564+
HasUnreferenceableStorage : 1,
565+
/// True if this struct is imported from C++ and does not have trivial value witness functions.
566+
IsCxxNonTrivial : 1);
567+
568568
SWIFT_INLINE_BITFIELD(EnumDecl, NominalTypeDecl, 2+1,
569569
/// True if the enum has cases and at least one case has associated values.
570570
HasAssociatedValues : 2,
@@ -3772,13 +3772,9 @@ class StructDecl final : public NominalTypeDecl {
37723772
Bits.StructDecl.HasUnreferenceableStorage = v;
37733773
}
37743774

3775-
bool isCxxNotTriviallyCopyable() const {
3776-
return Bits.StructDecl.IsCxxNotTriviallyCopyable;
3777-
}
3775+
bool isCxxNonTrivial() const { return Bits.StructDecl.IsCxxNonTrivial; }
37783776

3779-
void setIsCxxNotTriviallyCopyable(bool v) {
3780-
Bits.StructDecl.IsCxxNotTriviallyCopyable = v;
3781-
}
3777+
void setIsCxxNonTrivial(bool v) { Bits.StructDecl.IsCxxNonTrivial = v; }
37823778
};
37833779

37843780
/// This is the base type for AncestryOptions. Each flag describes possible

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4008,7 +4008,7 @@ StructDecl::StructDecl(SourceLoc StructLoc, Identifier Name, SourceLoc NameLoc,
40084008
StructLoc(StructLoc)
40094009
{
40104010
Bits.StructDecl.HasUnreferenceableStorage = false;
4011-
Bits.StructDecl.IsCxxNotTriviallyCopyable = false;
4011+
Bits.StructDecl.IsCxxNonTrivial = false;
40124012
}
40134013

40144014
bool NominalTypeDecl::hasMemberwiseInitializer() const {

lib/ClangImporter/ImportDecl.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,20 +3455,19 @@ namespace {
34553455
result->setHasUnreferenceableStorage(hasUnreferenceableStorage);
34563456

34573457
if (auto cxxRecordDecl = dyn_cast<clang::CXXRecordDecl>(decl)) {
3458-
result->setIsCxxNotTriviallyCopyable(
3459-
!cxxRecordDecl->isTriviallyCopyable());
3458+
result->setIsCxxNonTrivial(!cxxRecordDecl->isTriviallyCopyable());
34603459

34613460
for (auto ctor : cxxRecordDecl->ctors()) {
34623461
if (ctor->isCopyConstructor() &&
34633462
(ctor->isDeleted() || ctor->getAccess() != clang::AS_public)) {
3464-
result->setIsCxxNotTriviallyCopyable(true);
3463+
result->setIsCxxNonTrivial(true);
34653464
break;
34663465
}
34673466
}
34683467

34693468
if (auto dtor = cxxRecordDecl->getDestructor()) {
34703469
if (dtor->isDeleted() || dtor->getAccess() != clang::AS_public) {
3471-
result->setIsCxxNotTriviallyCopyable(true);
3470+
result->setIsCxxNonTrivial(true);
34723471
}
34733472
}
34743473
}

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ namespace {
16121612
if (handleResilience(structType, D, properties))
16131613
return handleAddressOnly(structType, properties);
16141614

1615-
if (D->isCxxNotTriviallyCopyable()) {
1615+
if (D->isCxxNonTrivial()) {
16161616
properties.setAddressOnly();
16171617
properties.setNonTrivial();
16181618
}

0 commit comments

Comments
 (0)