[PATCH] D35180: Expose the Clang::QualType to llvm::Type conversion functions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 11:26:17 PDT 2017


rjmccall added a comment.

Exposing these operations seems fine, but I'm not thrilled about the APIs.  Of course, the APIs are exactly derived from IRGen's internal APIs, but we'd like to eventually clean those APIs up, and we certainly don't need to emulate them.



================
Comment at: include/clang/CodeGen/CodeGenABITypes.h:74
 
+llvm::Type *ConvertType(CodeGenModule &CGM, QualType T);
+
----------------
Is this one actually important to expose?  What sorts of future APIs are you expecting where clients will interact with IRGen other than in memory?

If we do need this, we should name it something clear so that people don't accidentally reach for it by default.  (This has actually been a pain point within IRGen for years.)  How about:

llvm;:Type *convertTypeForRValue(CodeGenModule &CGM, QualType type);


================
Comment at: include/clang/CodeGen/CodeGenABITypes.h:78
+                                QualType FT,
+                                const FunctionDecl *FD = nullptr);
+
----------------
Let's make this a specific API for getting the type of a function declaration.

llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD);


================
Comment at: include/clang/CodeGen/CodeGenABITypes.h:80
+
+llvm::Type *ConvertTypeForMem(CodeGenModule &CGM, QualType T);
+
----------------
llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType type);


https://reviews.llvm.org/D35180





More information about the cfe-commits mailing list