[PATCH] D35180: Expose the Clang::QualType to llvm::Type conversion functions
Benoit Vey via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 9 06:24:13 PDT 2017
Praetonus created this revision.
This change exposes the various CodeGenTypes::ConvertType functions in the public Clang API. This allows external tools using the Clang API to rely on it to generate LLVM types from C types. The precise use case that motivated this change is explained in an email <https://lists.llvm.org/pipermail/cfe-dev/2017-July/054550.html> to the Clang mailing list.
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,20 @@
returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
info, {}, args);
}
+
+llvm::Type *
+CodeGen::ConvertType(CodeGenModule &CGM, QualType T) {
+ return CGM.getTypes().ConvertType(T);
+}
+
+llvm::Type *
+CodeGen::ConvertFunctionType(CodeGenModule &CGM,
+ QualType FT,
+ const FunctionDecl *FD) {
+ return CGM.getTypes().ConvertFunctionType(FT, FD);
+}
+
+llvm::Type *
+CodeGen::ConvertTypeForMem(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,14 @@
FunctionType::ExtInfo info,
RequiredArgs args);
+llvm::Type *ConvertType(CodeGenModule &CGM, QualType T);
+
+llvm::Type *ConvertFunctionType(CodeGenModule &CGM,
+ QualType FT,
+ const FunctionDecl *FD = nullptr);
+
+llvm::Type *ConvertTypeForMem(CodeGenModule &CGM, QualType T);
+
} // end namespace CodeGen
} // end namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35180.105761.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170709/84a6ed41/attachment.bin>
More information about the cfe-commits
mailing list