C++ modules

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

C++ modules

Loïc Joly
Hello,

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.

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?

Thank you,

--
Loïc


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

David Blaikie
If you check recent (the last 6 months or so) commits to clang by Doug
Gregor, you'll find some work to implement C++ modules is already
underway. As I understand it, the work is purely in clang, though
there's been recent talk of restructuring some of the common file
system abstractions across clang and llvm (though that's mostly
orthogonal to module support)
From: Loïc Joly
Sent: 12/29/2011 2:33 PM
To: [hidden email]
Subject: [cfe-dev] C++ modules
Hello,

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.

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?

Thank you,

--
Loïc


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

Loïc Joly
Le 30/12/2011 02:12, David Blaikie a écrit :
> If you check recent (the last 6 months or so) commits to clang by Doug
> Gregor, you'll find some work to implement C++ modules is already
> underway. As I understand it, the work is purely in clang, though
> there's been recent talk of restructuring some of the common file
> system abstractions across clang and llvm (though that's mostly
> orthogonal to module support)
>

Thank you for the information, I'll have a look at it.

--
Loïc

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

Miles Bader
In reply to this post by David Blaikie
David Blaikie <[hidden email]> writes:
> If you check recent (the last 6 months or so) commits to clang by Doug
> Gregor, you'll find some work to implement C++ modules is already
> underway.

Do you know what proposal this is based on?

Thanks,

-miles

--
Congratulation, n. The civility of envy.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

David Blaikie
On Fri, Dec 30, 2011 at 10:44 PM, Miles Bader <[hidden email]> wrote:
> David Blaikie <[hidden email]> writes:
>> If you check recent (the last 6 months or so) commits to clang by Doug
>> Gregor, you'll find some work to implement C++ modules is already
>> underway.
>
> Do you know what proposal this is based on?

I'm not sure how much it's based on any specific proposal.

To misquote Doug (can't find the email, I think it might've been on
IRC): "The semantics are obvious enough, so I'm implementing those.
After that we can haggle over the syntax"
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

Douglas Gregor
In reply to this post by Loïc Joly

On Dec 29, 2011, at 4:29 PM, Loïc Joly wrote:

> Hello,
>
> 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.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

Rafael Espíndola
> 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.

If I am the author of a module, am I expected to distribute the AST
files or will clang produce and cache them on the fly (or should their
creation be handled by the build system)?

> - Doug

Thanks,
Rafael
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: C++ modules

Douglas Gregor

On Jan 1, 2012, at 10:49 AM, Rafael Ávila de Espíndola wrote:

>> 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.
>
> If I am the author of a module, am I expected to distribute the AST
> files or will clang produce and cache them on the fly (or should their
> creation be handled by the build system)?

Clang will produce and cache them on the fly.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev