[cfe-dev] Exposing conversions from clang::QualType to llvm::Type
Benoit Vey via cfe-dev
cfe-dev at lists.llvm.org
Thu Jul 6 08:52:27 PDT 2017
Hello,
First of all, some context. I'm currently working on an LLVM-based
compiler for a language that needs advanced interoperability with C.
One key point of this is to be able to parse function declarations
from C headers to then call into C seamlessly. I'd like to use the
Clang API to build the correct declarations in LLVM IR but as far as I
can tell based on my (limited) knowledge of the Clang code base, this
isn't currently possible out of the box.
Clang currently exposes the CGFunctionInfo data structure, which
provides exhaustive information on function ABIs. However, the
construction of an llvm::Type from a CGFunctionInfo is implemented in
the CodeGenTypes::ConvertType functions, which are part of the
internal API. These functions are rather complex so I don't think that
reimplementing them in my compiler would be a good idea.
It seems to me that exposing the ConvertType functions in the public
API would be the correct way to solve the problem. I wanted to get
feedback on whether this would be a good idea, or if another direction
should be taken. I'd be happy to submit a patch once we've agreed on a
way forward.
Benoit Vey
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the cfe-dev
mailing list