Praetonus updated this revision to Diff 105793.
Praetonus added a comment.
Patch updated based on @rjmccall's comments. I removed the wrapper for the
ConvertType function, after giving it some thoughts I don't see any use case
for it, I guess I added it by default. I left the convertFreeFunction function
as returning an llvm::Type instead of an llvm::FunctionType as
ConvertFunctionType represents incomplete function types as empty aggregate
types.
https://reviews.llvm.org/D35180
Files:
include/clang/CodeGen/CodeGenABITypes.h
lib/CodeGen/CodeGenABITypes.cpp
Index: lib/CodeGen/CodeGenABITypes.cpp
===================================================================
--- lib/CodeGen/CodeGenABITypes.cpp
+++ lib/CodeGen/CodeGenABITypes.cpp
@@ -64,3 +64,14 @@
returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
info, {}, args);
}
+
+llvm::Type *
+CodeGen::convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD) {
+ assert(FD != nullptr && "Expected a non-null function declaration!");
+ return CGM.getTypes().ConvertFunctionType(FD->getType(), FD);
+}
+
+llvm::Type *
+CodeGen::convertTypeForMemory(CodeGenModule &CGM, QualType T) {
+ return CGM.getTypes().ConvertTypeForMem(T);
+}
Index: include/clang/CodeGen/CodeGenABITypes.h
===================================================================
--- include/clang/CodeGen/CodeGenABITypes.h
+++ include/clang/CodeGen/CodeGenABITypes.h
@@ -31,6 +31,7 @@
namespace llvm {
class DataLayout;
class Module;
+ class Type;
}
namespace clang {
@@ -70,6 +71,10 @@
FunctionType::ExtInfo info,
RequiredArgs args);
+llvm::Type *convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl
*FD);
+
+llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
+
} // end namespace CodeGen
} // end namespace clang
Index: lib/CodeGen/CodeGenABITypes.cpp
===================================================================
--- lib/CodeGen/CodeGenABITypes.cpp
+++ lib/CodeGen/CodeGenABITypes.cpp
@@ -64,3 +64,14 @@
returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
info, {}, args);
}
+
+llvm::Type *
+CodeGen::convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD) {
+ assert(FD != nullptr && "Expected a non-null function declaration!");
+ return CGM.getTypes().ConvertFunctionType(FD->getType(), FD);
+}
+
+llvm::Type *
+CodeGen::convertTypeForMemory(CodeGenModule &CGM, QualType T) {
+ return CGM.getTypes().ConvertTypeForMem(T);
+}
Index: include/clang/CodeGen/CodeGenABITypes.h
===================================================================
--- include/clang/CodeGen/CodeGenABITypes.h
+++ include/clang/CodeGen/CodeGenABITypes.h
@@ -31,6 +31,7 @@
namespace llvm {
class DataLayout;
class Module;
+ class Type;
}
namespace clang {
@@ -70,6 +71,10 @@
FunctionType::ExtInfo info,
RequiredArgs args);
+llvm::Type *convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD);
+
+llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
+
} // end namespace CodeGen
} // end namespace clang
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits