Skip to content
Snippets Groups Projects
Commit 5e97f3f2 authored by John McCall's avatar John McCall
Browse files

Expose some type-conversion functions as part of the IRGen ABI.

Patch by Benoit Vey!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307760 91177308-0d34-0410-b5e6-96231b3b80d8
parent 44b58372
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,8 @@
namespace llvm {
class DataLayout;
class Module;
class FunctionType;
class Type;
}
namespace clang {
......@@ -70,6 +72,12 @@ const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
FunctionType::ExtInfo info,
RequiredArgs args);
// Returns null if the function type is incomplete and can't be lowered.
llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM,
const FunctionDecl *FD);
llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
} // end namespace CodeGen
} // end namespace clang
......
......@@ -64,3 +64,19 @@ CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
info, {}, args);
}
llvm::FunctionType *
CodeGen::convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD) {
assert(FD != nullptr && "Expected a non-null function declaration!");
llvm::Type *T = CGM.getTypes().ConvertFunctionType(FD->getType(), FD);
if (auto FT = dyn_cast<llvm::FunctionType>(T))
return FT;
return nullptr;
}
llvm::Type *
CodeGen::convertTypeForMemory(CodeGenModule &CGM, QualType T) {
return CGM.getTypes().ConvertTypeForMem(T);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment