Handle indirect returns in @objc methods properly.

Use CodeGenABITypes to determine which return values should be indirect
in @objc methods.

Swift SVN r11184
This commit is contained in:
Mark Lacey
2013-12-12 07:22:12 +00:00
parent a55474bc49
commit 973ece4dc9
5 changed files with 129 additions and 5 deletions

View File

@@ -19,6 +19,7 @@
#include "swift/AST/Diagnostics.h"
#include "swift/ClangImporter/ClangImporter.h"
#include "swift/IRGen/Options.h"
#include "clang/CodeGen/CodeGenABITypes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
@@ -37,6 +38,7 @@
using namespace swift;
using namespace irgen;
using clang::CodeGen::CodeGenABITypes;
using llvm::Attribute;
const unsigned DefaultAS = 0;
@@ -199,9 +201,13 @@ IRGenModule::IRGenModule(ASTContext &Context,
// TODO: use "tinycc" on platforms that support it
RuntimeCC = llvm::CallingConv::C;
auto CI = static_cast<ClangImporter*>(&*Context.getClangModuleLoader());
assert(CI && "no clang module loader");
auto &clangASTContext = CI->getClangASTContext();
ABITypes = new CodeGenABITypes(clangASTContext, Module, DataLayout);
if (Opts.DebugInfo) {
auto CI = static_cast<ClangImporter*>(&*Context.getClangModuleLoader());
assert(CI && "no clang module loader");
DebugInfo = new IRGenDebugInfo(Opts, *CI, *this, Module);
}
}
@@ -210,6 +216,7 @@ IRGenModule::~IRGenModule() {
delete &Types;
if (DebugInfo)
delete DebugInfo;
delete ABITypes;
}
static llvm::Constant *getRuntimeFn(IRGenModule &IGM,