r307760 - Expose some type-conversion functions as part of the IRGen ABI.
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 00:44:17 PDT 2017
Author: rjmccall
Date: Wed Jul 12 00:44:17 2017
New Revision: 307760
URL: http://llvm.org/viewvc/llvm-project?rev=307760&view=rev
Log:
Expose some type-conversion functions as part of the IRGen ABI.
Patch by Benoit Vey!
Modified:
cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h
cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
Modified: cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h?rev=307760&r1=307759&r2=307760&view=diff
==============================================================================
--- cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h (original)
+++ cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h Wed Jul 12 00:44:17 2017
@@ -31,6 +31,8 @@
namespace llvm {
class DataLayout;
class Module;
+ class FunctionType;
+ class Type;
}
namespace clang {
@@ -70,6 +72,12 @@ const CGFunctionInfo &arrangeFreeFunctio
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
Modified: cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp?rev=307760&r1=307759&r2=307760&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Wed Jul 12 00:44:17 2017
@@ -64,3 +64,19 @@ CodeGen::arrangeFreeFunctionCall(CodeGen
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);
+}
More information about the cfe-commits
mailing list