summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp8
-rw-r--r--clang/lib/AST/Decl.cpp2
-rw-r--r--clang/lib/AST/DeclCXX.cpp12
-rw-r--r--clang/lib/AST/Type.cpp6
4 files changed, 17 insertions, 11 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 77c06f21dfb..ea96a077631 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2643,9 +2643,11 @@ void ASTContext::adjustExceptionSpec(
}
bool ASTContext::isParamDestroyedInCallee(QualType T) const {
- return getTargetInfo().getCXXABI().areArgsDestroyedLeftToRightInCallee() ||
- T.hasTrivialABIOverride() ||
- T.isDestructedType() == QualType::DK_nontrivial_c_struct;
+ if (getTargetInfo().getCXXABI().areArgsDestroyedLeftToRightInCallee())
+ return true;
+ if (const auto *RT = T->getBaseElementTypeUnsafe()->getAs<RecordType>())
+ return RT->getDecl()->isParamDestroyedInCallee();
+ return false;
}
/// getComplexType - Return the uniqued reference to the type for a complex
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index ed80dd8fca2..4fb687d0fdd 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3951,7 +3951,7 @@ RecordDecl::RecordDecl(Kind DK, TagKind TK, const ASTContext &C,
LoadedFieldsFromExternalStorage(false),
NonTrivialToPrimitiveDefaultInitialize(false),
NonTrivialToPrimitiveCopy(false), NonTrivialToPrimitiveDestroy(false),
- CanPassInRegisters(true) {
+ CanPassInRegisters(true), ParamDestroyedInCallee(false) {
assert(classof(static_cast<Decl*>(this)) && "Invalid Kind!");
}
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 271872352cd..1e1ee439d8d 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -801,7 +801,17 @@ void CXXRecordDecl::addedMember(Decl *D) {
struct DefinitionData &Data = data();
Data.PlainOldData = false;
Data.HasTrivialSpecialMembers = 0;
- Data.HasTrivialSpecialMembersForCall = 0;
+
+ // __strong or __weak fields do not make special functions non-trivial
+ // for the purpose of calls.
+ Qualifiers::ObjCLifetime LT = T.getQualifiers().getObjCLifetime();
+ if (LT != Qualifiers::OCL_Strong && LT != Qualifiers::OCL_Weak)
+ data().HasTrivialSpecialMembersForCall = 0;
+
+ // Structs with __weak fields should never be passed directly.
+ if (LT == Qualifiers::OCL_Weak)
+ setCanPassInRegisters(false);
+
Data.HasIrrelevantDestructor = false;
} else if (!Context.getLangOpts().ObjCAutoRefCount) {
setHasObjectMember(true);
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 2985aac66b2..d8b9967cdc8 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2195,12 +2195,6 @@ bool QualType::isTriviallyCopyableType(const ASTContext &Context) const {
return false;
}
-bool QualType::hasTrivialABIOverride() const {
- if (const auto *RD = getTypePtr()->getAsCXXRecordDecl())
- return RD->hasTrivialABIOverride();
- return false;
-}
-
bool QualType::isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const {
return !Context.getLangOpts().ObjCAutoRefCount &&
Context.getLangOpts().ObjCWeak &&
OpenPOWER on IntegriCloud