[cfe-dev] C++ modules
dgregor at apple.com
Sun Jan 1 10:30:36 PST 2012
On Dec 29, 2011, at 4:29 PM, Loïc Joly wrote:
> I'm totally new to Clang and LLVM, but I want to give it a try as a test
> platform for new C++ features. I'm mostly interested in the proposals
> around modifying the C++ build process to introduce the notion of
> modules, and I would need some help from people who know the
> architecture to look at the right places.
Most of the work I'm doing is in three places. The Serialization module, which takes care of serializing/deserializing an already-parsed AST, is the hardest part: it's the infrastructure that allows one to compile a module on its own, storing the serialized AST to disk, and then load that module into another translation unit later on. This part is likely to be the same regardless of how modules behave.
The module map part of the Lex module handles the mapping between headers and modules. It's mainly a transitional a little sub-language that allows one to describe the relationships between headers (which are used everywhere today) and modules.
The easy part is the parsing of module imports, labeling what is exported/hidden, and name-lookup semantics. It's also the part that people will want to discuss endlessly, so for now the various keywords are uglified so that we don't commit to any one syntax.
> My first question is the following: Do you believe implementing modules
> in C++ can be done at the Clang level, or does it require changes to the
> LLVM level too?
The vast majority of the work will be at the Clang level, because all of the hard problems are there. It's possible that there will a tiny amount of work in LLVM in the future, e.g., to pass module-import information down to the linker, but that's gravy.
More information about the cfe-dev