summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 08d3bc21a24..55c7a9ae24d 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5847,20 +5847,20 @@ static bool paramCanBeDestroyedInCallee(Sema &S, CXXRecordDecl *D,
return HasNonDeletedCopyOrMove;
}
-static RecordDecl::ArgPassingKind
-computeArgPassingRestrictions(bool DestroyedInCallee, const CXXRecordDecl *RD,
- TargetInfo::CallingConvKind CCK, Sema &S) {
+static bool computeCanPassInRegister(bool DestroyedInCallee,
+ const CXXRecordDecl *RD,
+ TargetInfo::CallingConvKind CCK,
+ Sema &S) {
if (RD->isDependentType() || RD->isInvalidDecl())
- return RecordDecl::APK_CanPassInRegs;
+ return true;
- // The param cannot be passed in registers if ArgPassingRestrictions is set to
- // APK_CanNeverPassInRegs.
- if (RD->getArgPassingRestrictions() == RecordDecl::APK_CanNeverPassInRegs)
- return RecordDecl::APK_CanNeverPassInRegs;
+ // The param cannot be passed in registers if CanPassInRegisters is already
+ // set to false.
+ if (!RD->canPassInRegisters())
+ return false;
if (CCK != TargetInfo::CCK_MicrosoftX86_64)
- return DestroyedInCallee ? RecordDecl::APK_CanPassInRegs
- : RecordDecl::APK_CannotPassInRegs;
+ return DestroyedInCallee;
bool CopyCtorIsTrivial = false, CopyCtorIsTrivialForCall = false;
bool DtorIsTrivialForCall = false;
@@ -5900,7 +5900,7 @@ computeArgPassingRestrictions(bool DestroyedInCallee, const CXXRecordDecl *RD,
// If the copy ctor and dtor are both trivial-for-calls, pass direct.
if (CopyCtorIsTrivialForCall && DtorIsTrivialForCall)
- return RecordDecl::APK_CanPassInRegs;
+ return true;
// If a class has a destructor, we'd really like to pass it indirectly
// because it allows us to elide copies. Unfortunately, MSVC makes that
@@ -5914,8 +5914,8 @@ computeArgPassingRestrictions(bool DestroyedInCallee, const CXXRecordDecl *RD,
// passed in registers, which is non-conforming.
if (CopyCtorIsTrivial &&
S.getASTContext().getTypeSize(RD->getTypeForDecl()) <= 64)
- return RecordDecl::APK_CanPassInRegs;
- return RecordDecl::APK_CannotPassInRegs;
+ return true;
+ return false;
}
/// \brief Perform semantic checks on a class definition that has been
@@ -6090,8 +6090,8 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
if (Record->hasNonTrivialDestructor())
Record->setParamDestroyedInCallee(DestroyedInCallee);
- Record->setArgPassingRestrictions(
- computeArgPassingRestrictions(DestroyedInCallee, Record, CCK, *this));
+ Record->setCanPassInRegisters(
+ computeCanPassInRegister(DestroyedInCallee, Record, CCK, *this));
}
/// Look up the special member function that would be called by a special
OpenPOWER on IntegriCloud