diff options
author | John McCall <rjmccall@apple.com> | 2018-01-07 06:28:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2018-01-07 06:28:49 +0000 |
commit | 56331e28648458aa9482dfab4c10e81b30f9e05c (patch) | |
tree | 47117170ab2576ee060226791c9c00a812b0bfbc /clang/lib/CodeGen/SwiftCallingConv.cpp | |
parent | d0859a03b560629f58498d1346e1c47ae32c6cc1 (diff) | |
download | bcm5719-llvm-56331e28648458aa9482dfab4c10e81b30f9e05c.tar.gz bcm5719-llvm-56331e28648458aa9482dfab4c10e81b30f9e05c.zip |
Simplify the internal API for checking whether swiftcall passes a type indirectly and expose that API externally.
llvm-svn: 321957
Diffstat (limited to 'clang/lib/CodeGen/SwiftCallingConv.cpp')
-rw-r--r-- | clang/lib/CodeGen/SwiftCallingConv.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/SwiftCallingConv.cpp b/clang/lib/CodeGen/SwiftCallingConv.cpp index fc8e36d2c59..2a12078e198 100644 --- a/clang/lib/CodeGen/SwiftCallingConv.cpp +++ b/clang/lib/CodeGen/SwiftCallingConv.cpp @@ -579,11 +579,9 @@ bool SwiftAggLowering::shouldPassIndirectly(bool asReturnValue) const { // Empty types don't need to be passed indirectly. if (Entries.empty()) return false; - CharUnits totalSize = Entries.back().End; - // Avoid copying the array of types when there's just a single element. if (Entries.size() == 1) { - return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift(totalSize, + return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift( Entries.back().Type, asReturnValue); } @@ -593,8 +591,14 @@ bool SwiftAggLowering::shouldPassIndirectly(bool asReturnValue) const { for (auto &entry : Entries) { componentTys.push_back(entry.Type); } - return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift(totalSize, - componentTys, + return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift(componentTys, + asReturnValue); +} + +bool swiftcall::shouldPassIndirectly(CodeGenModule &CGM, + ArrayRef<llvm::Type*> componentTys, + bool asReturnValue) { + return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift(componentTys, asReturnValue); } |