diff options
author | John McCall <rjmccall@apple.com> | 2018-04-07 20:16:47 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2018-04-07 20:16:47 +0000 |
commit | bfbc05e2f5529991632e42a0dcce771e7283e93c (patch) | |
tree | 0470c60b4aa040705457c775ac87b58f9af2fc17 /clang/lib/CodeGen/SwiftCallingConv.cpp | |
parent | 9487d90e227457b4d35889db989a722bf0a6c43b (diff) | |
download | bcm5719-llvm-bfbc05e2f5529991632e42a0dcce771e7283e93c.tar.gz bcm5719-llvm-bfbc05e2f5529991632e42a0dcce771e7283e93c.zip |
Generalize the swiftcall API since being passed indirectly isn't
C++-specific anymore.
llvm-svn: 329513
Diffstat (limited to 'clang/lib/CodeGen/SwiftCallingConv.cpp')
-rw-r--r-- | clang/lib/CodeGen/SwiftCallingConv.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/SwiftCallingConv.cpp b/clang/lib/CodeGen/SwiftCallingConv.cpp index 7dc2a1d089d..3673a5597ea 100644 --- a/clang/lib/CodeGen/SwiftCallingConv.cpp +++ b/clang/lib/CodeGen/SwiftCallingConv.cpp @@ -740,8 +740,8 @@ void swiftcall::legalizeVectorType(CodeGenModule &CGM, CharUnits origVectorSize, components.append(numElts, eltTy); } -bool swiftcall::shouldPassCXXRecordIndirectly(CodeGenModule &CGM, - const CXXRecordDecl *record) { +bool swiftcall::mustPassRecordIndirectly(CodeGenModule &CGM, + const RecordDecl *record) { // FIXME: should we not rely on the standard computation in Sema, just in // case we want to diverge from the platform ABI (e.g. on targets where // that uses the MSVC rule)? @@ -767,10 +767,8 @@ static ABIArgInfo classifyType(CodeGenModule &CGM, CanQualType type, auto record = recordType->getDecl(); auto &layout = CGM.getContext().getASTRecordLayout(record); - if (auto cxxRecord = dyn_cast<CXXRecordDecl>(record)) { - if (shouldPassCXXRecordIndirectly(CGM, cxxRecord)) - return ABIArgInfo::getIndirect(layout.getAlignment(), /*byval*/ false); - } + if (mustPassRecordIndirectly(CGM, record)) + return ABIArgInfo::getIndirect(layout.getAlignment(), /*byval*/ false); SwiftAggLowering lowering(CGM); lowering.addTypedData(recordType->getDecl(), CharUnits::Zero(), layout); |