Re: r313316 - [Module map] Introduce a private module re-export directive.

2017-09-20 Thread Galina Kistanova via cfe-commits
Thanks for looking.
It seems  your commit exposed some other issue. Now, unfortunately, it has
stopped being reproducible.
Thanks for looking anyway.

A good bug will show itself sooner or later.

Thanks

Galina


On Mon, Sep 18, 2017 at 3:49 PM, Douglas Gregor  wrote:

>
> On Sep 18, 2017, at 3:11 PM, Richard Smith  wrote:
>
> On 18 September 2017 at 14:34, Douglas Gregor via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>> On Sep 18, 2017, at 1:45 PM, Galina Kistanova 
>> wrote:
>>
>> Hello Douglas,
>>
>> Your r313316 commit broke one of our builders on Thursday, Sep-14th.
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-
>> scei-ps4-ubuntu-fast/builds/17506
>>
>> Are you about to commit the fix, or shall I revert that commit to give
>> you more time?
>>
>>
>> I’m unable to reproduce this issue, and it’s weirdly not hitting the
>> other bots.
>>
>> Is anyone able to reproduce this? The stack trace is… insufficient… to
>> figure out what’s going on.
>>
>
> I think that bot might be the only one with a target whose default C++
> language mode is C++11.
>
>
> Hmm. It’s not the C++ RUN lines that are failing, though; it’s the default
> (Objective-C) one.
>
> - Doug
>
>
>
>> - Doug
>>
>>
>> Thanks
>>
>> Galina
>>
>> On Thu, Sep 14, 2017 at 4:38 PM, Douglas Gregor via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: dgregor
>>> Date: Thu Sep 14 16:38:44 2017
>>> New Revision: 313316
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev
>>> Log:
>>> [Module map] Introduce a private module re-export directive.
>>>
>>> Introduce a new "export_as" directive for top-level modules, which
>>> indicates that the current module is a "private" module whose symbols
>>> will eventually be exported through the named "public" module. This is
>>> in support of a common pattern in the Darwin ecosystem where a single
>>> public framework is constructed of several private frameworks, with
>>> (currently) header duplication and some support from the linker.
>>>
>>> Addresses rdar://problem/34438420.
>>>
>>> Added:
>>> cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
>>> cfe/trunk/test/Modules/export_as_test.c
>>> Modified:
>>> cfe/trunk/docs/Modules.rst
>>> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>>> cfe/trunk/include/clang/Basic/Module.h
>>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>>> cfe/trunk/lib/Basic/Module.cpp
>>> cfe/trunk/lib/Lex/ModuleMap.cpp
>>> cfe/trunk/lib/Serialization/ASTReader.cpp
>>> cfe/trunk/lib/Serialization/ASTWriter.cpp
>>>
>>> Modified: cfe/trunk/docs/Modules.rst
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.r
>>> st?rev=313316=313315=313316=diff
>>> 
>>> ==
>>> --- cfe/trunk/docs/Modules.rst (original)
>>> +++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
>>> @@ -323,11 +323,12 @@ Module map files use a simplified form o
>>>
>>>  .. parsed-literal::
>>>
>>> -  ``config_macros`` ``export`` ``private``
>>> +  ``config_macros`` ``export_as``  ``private``
>>>``conflict``  ``framework``  ``requires``
>>>``exclude``   ``header`` ``textual``
>>>``explicit``  ``link``   ``umbrella``
>>>``extern````module`` ``use``
>>> +  ``export``
>>>
>>>  Module map file
>>>  ---
>>> @@ -387,6 +388,7 @@ Modules can have a number of different k
>>>  *umbrella-dir-declaration*
>>>  *submodule-declaration*
>>>  *export-declaration*
>>> +*export-as-declaration*
>>>  *use-declaration*
>>>  *link-declaration*
>>>  *config-macros-declaration*
>>> @@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
>>>compatibility for programs that rely on transitive inclusion (i.e.,
>>>all of them).
>>>
>>> +Re-export Declaration
>>> +~~
>>> +An *export-as-declaration* specifies that the current module is a
>>> private
>>> +module whose interface will be re-exported by the named public module.
>>> +
>>> +.. parsed-literal::
>>> +
>>> +  *export-as-declaration*:
>>> +``export_as`` *identifier*
>>> +
>>> +The *export-as-declaration* names the public module that the current
>>> +(private) module will be re-exported through. Only top-level modules
>>> +can be re-exported, and any given module may only be re-exported
>>> +through a single public module.
>>> +
>>> +**Example:** In the following example, the (private) module
>>> +``MyFrameworkCore`` will be re-exported via the public module
>>> +``MyFramework``:
>>> +
>>> +.. parsed-literal::
>>> +
>>> +  module MyFrameworkCore {
>>> +export_as MyFramework
>>> +  }
>>> +
>>>  Use declaration
>>>  ~~~
>>>  A *use-declaration* specifies another module that the current top-level
>>> module
>>>
>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>>> URL: 

Re: r313316 - [Module map] Introduce a private module re-export directive.

2017-09-18 Thread Douglas Gregor via cfe-commits

> On Sep 18, 2017, at 3:11 PM, Richard Smith  wrote:
> 
> On 18 September 2017 at 14:34, Douglas Gregor via cfe-commits 
> > wrote:
> 
>> On Sep 18, 2017, at 1:45 PM, Galina Kistanova > > wrote:
>> 
>> Hello Douglas,
>> 
>> Your r313316 commit broke one of our builders on Thursday, Sep-14th.
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17506
>>  
>> 
>> 
>> Are you about to commit the fix, or shall I revert that commit to give you 
>> more time?
> 
> I’m unable to reproduce this issue, and it’s weirdly not hitting the other 
> bots.
> 
> Is anyone able to reproduce this? The stack trace is… insufficient… to figure 
> out what’s going on.
> 
> I think that bot might be the only one with a target whose default C++ 
> language mode is C++11.

Hmm. It’s not the C++ RUN lines that are failing, though; it’s the default 
(Objective-C) one.

- Doug

>  
>   - Doug
> 
>> 
>> Thanks
>> 
>> Galina
>> 
>> On Thu, Sep 14, 2017 at 4:38 PM, Douglas Gregor via cfe-commits 
>> > wrote:
>> Author: dgregor
>> Date: Thu Sep 14 16:38:44 2017
>> New Revision: 313316
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev 
>> 
>> Log:
>> [Module map] Introduce a private module re-export directive.
>> 
>> Introduce a new "export_as" directive for top-level modules, which
>> indicates that the current module is a "private" module whose symbols
>> will eventually be exported through the named "public" module. This is
>> in support of a common pattern in the Darwin ecosystem where a single
>> public framework is constructed of several private frameworks, with
>> (currently) header duplication and some support from the linker.
>> 
>> Addresses rdar://problem/34438420 <>.
>> 
>> Added:
>> cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
>> cfe/trunk/test/Modules/export_as_test.c
>> Modified:
>> cfe/trunk/docs/Modules.rst
>> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>> cfe/trunk/include/clang/Basic/Module.h
>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>> cfe/trunk/lib/Basic/Module.cpp
>> cfe/trunk/lib/Lex/ModuleMap.cpp
>> cfe/trunk/lib/Serialization/ASTReader.cpp
>> cfe/trunk/lib/Serialization/ASTWriter.cpp
>> 
>> Modified: cfe/trunk/docs/Modules.rst
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=313316=313315=313316=diff
>>  
>> 
>> ==
>> --- cfe/trunk/docs/Modules.rst (original)
>> +++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
>> @@ -323,11 +323,12 @@ Module map files use a simplified form o
>> 
>>  .. parsed-literal::
>> 
>> -  ``config_macros`` ``export`` ``private``
>> +  ``config_macros`` ``export_as``  ``private``
>>``conflict``  ``framework``  ``requires``
>>``exclude``   ``header`` ``textual``
>>``explicit``  ``link``   ``umbrella``
>>``extern````module`` ``use``
>> +  ``export``
>> 
>>  Module map file
>>  ---
>> @@ -387,6 +388,7 @@ Modules can have a number of different k
>>  *umbrella-dir-declaration*
>>  *submodule-declaration*
>>  *export-declaration*
>> +*export-as-declaration*
>>  *use-declaration*
>>  *link-declaration*
>>  *config-macros-declaration*
>> @@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
>>compatibility for programs that rely on transitive inclusion (i.e.,
>>all of them).
>> 
>> +Re-export Declaration
>> +~~
>> +An *export-as-declaration* specifies that the current module is a private
>> +module whose interface will be re-exported by the named public module.
>> +
>> +.. parsed-literal::
>> +
>> +  *export-as-declaration*:
>> +``export_as`` *identifier*
>> +
>> +The *export-as-declaration* names the public module that the current
>> +(private) module will be re-exported through. Only top-level modules
>> +can be re-exported, and any given module may only be re-exported
>> +through a single public module.
>> +
>> +**Example:** In the following example, the (private) module
>> +``MyFrameworkCore`` will be re-exported via the public module
>> +``MyFramework``:
>> +
>> +.. parsed-literal::
>> +
>> +  module MyFrameworkCore {
>> +export_as MyFramework
>> +  }
>> +
>>  Use declaration
>>  ~~~
>>  A *use-declaration* specifies another module that the current top-level 
>> module
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>> URL: 
>> 

Re: r313316 - [Module map] Introduce a private module re-export directive.

2017-09-18 Thread Richard Smith via cfe-commits
On 18 September 2017 at 14:34, Douglas Gregor via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> On Sep 18, 2017, at 1:45 PM, Galina Kistanova 
> wrote:
>
> Hello Douglas,
>
> Your r313316 commit broke one of our builders on Thursday, Sep-14th.
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_
> 64-scei-ps4-ubuntu-fast/builds/17506
>
> Are you about to commit the fix, or shall I revert that commit to give you
> more time?
>
>
> I’m unable to reproduce this issue, and it’s weirdly not hitting the other
> bots.
>
> Is anyone able to reproduce this? The stack trace is… insufficient… to
> figure out what’s going on.
>

I think that bot might be the only one with a target whose default C++
language mode is C++11.


> - Doug
>
>
> Thanks
>
> Galina
>
> On Thu, Sep 14, 2017 at 4:38 PM, Douglas Gregor via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: dgregor
>> Date: Thu Sep 14 16:38:44 2017
>> New Revision: 313316
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev
>> Log:
>> [Module map] Introduce a private module re-export directive.
>>
>> Introduce a new "export_as" directive for top-level modules, which
>> indicates that the current module is a "private" module whose symbols
>> will eventually be exported through the named "public" module. This is
>> in support of a common pattern in the Darwin ecosystem where a single
>> public framework is constructed of several private frameworks, with
>> (currently) header duplication and some support from the linker.
>>
>> Addresses rdar://problem/34438420.
>>
>> Added:
>> cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
>> cfe/trunk/test/Modules/export_as_test.c
>> Modified:
>> cfe/trunk/docs/Modules.rst
>> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>> cfe/trunk/include/clang/Basic/Module.h
>> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>> cfe/trunk/lib/Basic/Module.cpp
>> cfe/trunk/lib/Lex/ModuleMap.cpp
>> cfe/trunk/lib/Serialization/ASTReader.cpp
>> cfe/trunk/lib/Serialization/ASTWriter.cpp
>>
>> Modified: cfe/trunk/docs/Modules.rst
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.
>> rst?rev=313316=313315=313316=diff
>> 
>> ==
>> --- cfe/trunk/docs/Modules.rst (original)
>> +++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
>> @@ -323,11 +323,12 @@ Module map files use a simplified form o
>>
>>  .. parsed-literal::
>>
>> -  ``config_macros`` ``export`` ``private``
>> +  ``config_macros`` ``export_as``  ``private``
>>``conflict``  ``framework``  ``requires``
>>``exclude``   ``header`` ``textual``
>>``explicit``  ``link``   ``umbrella``
>>``extern````module`` ``use``
>> +  ``export``
>>
>>  Module map file
>>  ---
>> @@ -387,6 +388,7 @@ Modules can have a number of different k
>>  *umbrella-dir-declaration*
>>  *submodule-declaration*
>>  *export-declaration*
>> +*export-as-declaration*
>>  *use-declaration*
>>  *link-declaration*
>>  *config-macros-declaration*
>> @@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
>>compatibility for programs that rely on transitive inclusion (i.e.,
>>all of them).
>>
>> +Re-export Declaration
>> +~~
>> +An *export-as-declaration* specifies that the current module is a private
>> +module whose interface will be re-exported by the named public module.
>> +
>> +.. parsed-literal::
>> +
>> +  *export-as-declaration*:
>> +``export_as`` *identifier*
>> +
>> +The *export-as-declaration* names the public module that the current
>> +(private) module will be re-exported through. Only top-level modules
>> +can be re-exported, and any given module may only be re-exported
>> +through a single public module.
>> +
>> +**Example:** In the following example, the (private) module
>> +``MyFrameworkCore`` will be re-exported via the public module
>> +``MyFramework``:
>> +
>> +.. parsed-literal::
>> +
>> +  module MyFrameworkCore {
>> +export_as MyFramework
>> +  }
>> +
>>  Use declaration
>>  ~~~
>>  A *use-declaration* specifies another module that the current top-level
>> module
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>> Basic/DiagnosticLexKinds.td?rev=313316=313315=313316=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Sep 14
>> 16:38:44 2017
>> @@ -674,6 +674,13 @@ def err_mmap_invalid_header_attribute_va
>>"expected integer literal as value for header attribute '%0'">;
>>  def err_mmap_expected_header_attribute : Error<
>>"expected a header attribute name ('size' or 'mtime')">;
>> +def 

Re: r313316 - [Module map] Introduce a private module re-export directive.

2017-09-18 Thread Douglas Gregor via cfe-commits

> On Sep 18, 2017, at 1:45 PM, Galina Kistanova  wrote:
> 
> Hello Douglas,
> 
> Your r313316 commit broke one of our builders on Thursday, Sep-14th.
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17506
>  
> 
> 
> Are you about to commit the fix, or shall I revert that commit to give you 
> more time?

I’m unable to reproduce this issue, and it’s weirdly not hitting the other bots.

Is anyone able to reproduce this? The stack trace is… insufficient… to figure 
out what’s going on.

- Doug

> 
> Thanks
> 
> Galina
> 
> On Thu, Sep 14, 2017 at 4:38 PM, Douglas Gregor via cfe-commits 
> > wrote:
> Author: dgregor
> Date: Thu Sep 14 16:38:44 2017
> New Revision: 313316
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev 
> 
> Log:
> [Module map] Introduce a private module re-export directive.
> 
> Introduce a new "export_as" directive for top-level modules, which
> indicates that the current module is a "private" module whose symbols
> will eventually be exported through the named "public" module. This is
> in support of a common pattern in the Darwin ecosystem where a single
> public framework is constructed of several private frameworks, with
> (currently) header duplication and some support from the linker.
> 
> Addresses rdar://problem/34438420.
> 
> Added:
> cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
> cfe/trunk/test/Modules/export_as_test.c
> Modified:
> cfe/trunk/docs/Modules.rst
> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> cfe/trunk/include/clang/Basic/Module.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/Basic/Module.cpp
> cfe/trunk/lib/Lex/ModuleMap.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/lib/Serialization/ASTWriter.cpp
> 
> Modified: cfe/trunk/docs/Modules.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=313316=313315=313316=diff
>  
> 
> ==
> --- cfe/trunk/docs/Modules.rst (original)
> +++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
> @@ -323,11 +323,12 @@ Module map files use a simplified form o
> 
>  .. parsed-literal::
> 
> -  ``config_macros`` ``export`` ``private``
> +  ``config_macros`` ``export_as``  ``private``
>``conflict``  ``framework``  ``requires``
>``exclude``   ``header`` ``textual``
>``explicit``  ``link``   ``umbrella``
>``extern````module`` ``use``
> +  ``export``
> 
>  Module map file
>  ---
> @@ -387,6 +388,7 @@ Modules can have a number of different k
>  *umbrella-dir-declaration*
>  *submodule-declaration*
>  *export-declaration*
> +*export-as-declaration*
>  *use-declaration*
>  *link-declaration*
>  *config-macros-declaration*
> @@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
>compatibility for programs that rely on transitive inclusion (i.e.,
>all of them).
> 
> +Re-export Declaration
> +~~
> +An *export-as-declaration* specifies that the current module is a private
> +module whose interface will be re-exported by the named public module.
> +
> +.. parsed-literal::
> +
> +  *export-as-declaration*:
> +``export_as`` *identifier*
> +
> +The *export-as-declaration* names the public module that the current
> +(private) module will be re-exported through. Only top-level modules
> +can be re-exported, and any given module may only be re-exported
> +through a single public module.
> +
> +**Example:** In the following example, the (private) module
> +``MyFrameworkCore`` will be re-exported via the public module
> +``MyFramework``:
> +
> +.. parsed-literal::
> +
> +  module MyFrameworkCore {
> +export_as MyFramework
> +  }
> +
>  Use declaration
>  ~~~
>  A *use-declaration* specifies another module that the current top-level 
> module
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=313316=313315=313316=diff
>  
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Sep 14 16:38:44 
> 2017
> @@ -674,6 +674,13 @@ def err_mmap_invalid_header_attribute_va
>"expected integer literal as value for header attribute '%0'">;
>  def 

Re: r313316 - [Module map] Introduce a private module re-export directive.

2017-09-18 Thread Galina Kistanova via cfe-commits
Hello Douglas,

Your r313316 commit broke one of our builders on Thursday, Sep-14th.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17506

Are you about to commit the fix, or shall I revert that commit to give you
more time?

Thanks

Galina

On Thu, Sep 14, 2017 at 4:38 PM, Douglas Gregor via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: dgregor
> Date: Thu Sep 14 16:38:44 2017
> New Revision: 313316
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev
> Log:
> [Module map] Introduce a private module re-export directive.
>
> Introduce a new "export_as" directive for top-level modules, which
> indicates that the current module is a "private" module whose symbols
> will eventually be exported through the named "public" module. This is
> in support of a common pattern in the Darwin ecosystem where a single
> public framework is constructed of several private frameworks, with
> (currently) header duplication and some support from the linker.
>
> Addresses rdar://problem/34438420.
>
> Added:
> cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
> cfe/trunk/test/Modules/export_as_test.c
> Modified:
> cfe/trunk/docs/Modules.rst
> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> cfe/trunk/include/clang/Basic/Module.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/Basic/Module.cpp
> cfe/trunk/lib/Lex/ModuleMap.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/lib/Serialization/ASTWriter.cpp
>
> Modified: cfe/trunk/docs/Modules.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/
> Modules.rst?rev=313316=313315=313316=diff
> 
> ==
> --- cfe/trunk/docs/Modules.rst (original)
> +++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
> @@ -323,11 +323,12 @@ Module map files use a simplified form o
>
>  .. parsed-literal::
>
> -  ``config_macros`` ``export`` ``private``
> +  ``config_macros`` ``export_as``  ``private``
>``conflict``  ``framework``  ``requires``
>``exclude``   ``header`` ``textual``
>``explicit``  ``link``   ``umbrella``
>``extern````module`` ``use``
> +  ``export``
>
>  Module map file
>  ---
> @@ -387,6 +388,7 @@ Modules can have a number of different k
>  *umbrella-dir-declaration*
>  *submodule-declaration*
>  *export-declaration*
> +*export-as-declaration*
>  *use-declaration*
>  *link-declaration*
>  *config-macros-declaration*
> @@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
>compatibility for programs that rely on transitive inclusion (i.e.,
>all of them).
>
> +Re-export Declaration
> +~~
> +An *export-as-declaration* specifies that the current module is a private
> +module whose interface will be re-exported by the named public module.
> +
> +.. parsed-literal::
> +
> +  *export-as-declaration*:
> +``export_as`` *identifier*
> +
> +The *export-as-declaration* names the public module that the current
> +(private) module will be re-exported through. Only top-level modules
> +can be re-exported, and any given module may only be re-exported
> +through a single public module.
> +
> +**Example:** In the following example, the (private) module
> +``MyFrameworkCore`` will be re-exported via the public module
> +``MyFramework``:
> +
> +.. parsed-literal::
> +
> +  module MyFrameworkCore {
> +export_as MyFramework
> +  }
> +
>  Use declaration
>  ~~~
>  A *use-declaration* specifies another module that the current top-level
> module
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticLexKinds.td?rev=313316=313315=313316=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Sep 14
> 16:38:44 2017
> @@ -674,6 +674,13 @@ def err_mmap_invalid_header_attribute_va
>"expected integer literal as value for header attribute '%0'">;
>  def err_mmap_expected_header_attribute : Error<
>"expected a header attribute name ('size' or 'mtime')">;
> +def err_mmap_conflicting_export_as : Error<
> +  "conflicting re-export of module '%0' as '%1' or '%2'">;
> +def warn_mmap_redundant_export_as : Warning<
> +  "module '%0' already re-exported as '%1'">,
> +  InGroup;
> +def err_mmap_submodule_export_as : Error<
> +  "only top-level modules can be re-exported as public">;
>
>  def warn_auto_module_import : Warning<
>"treating #%select{include|import|include_next|__include_macros}0 as
> an "
>
> Modified: cfe/trunk/include/clang/Basic/Module.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/Module.h?rev=313316=313315=313316=diff
> 

r313316 - [Module map] Introduce a private module re-export directive.

2017-09-14 Thread Douglas Gregor via cfe-commits
Author: dgregor
Date: Thu Sep 14 16:38:44 2017
New Revision: 313316

URL: http://llvm.org/viewvc/llvm-project?rev=313316=rev
Log:
[Module map] Introduce a private module re-export directive.

Introduce a new "export_as" directive for top-level modules, which
indicates that the current module is a "private" module whose symbols
will eventually be exported through the named "public" module. This is
in support of a common pattern in the Darwin ecosystem where a single
public framework is constructed of several private frameworks, with
(currently) header duplication and some support from the linker.

Addresses rdar://problem/34438420.

Added:
cfe/trunk/test/Modules/Inputs/export_as_test.modulemap
cfe/trunk/test/Modules/export_as_test.c
Modified:
cfe/trunk/docs/Modules.rst
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/Module.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/docs/Modules.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=313316=313315=313316=diff
==
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Thu Sep 14 16:38:44 2017
@@ -323,11 +323,12 @@ Module map files use a simplified form o
 
 .. parsed-literal::
 
-  ``config_macros`` ``export`` ``private``
+  ``config_macros`` ``export_as``  ``private``
   ``conflict``  ``framework``  ``requires``
   ``exclude``   ``header`` ``textual``
   ``explicit``  ``link``   ``umbrella``
   ``extern````module`` ``use``
+  ``export``
 
 Module map file
 ---
@@ -387,6 +388,7 @@ Modules can have a number of different k
 *umbrella-dir-declaration*
 *submodule-declaration*
 *export-declaration*
+*export-as-declaration*
 *use-declaration*
 *link-declaration*
 *config-macros-declaration*
@@ -666,6 +668,31 @@ Note that, if ``Derived.h`` includes ``B
   compatibility for programs that rely on transitive inclusion (i.e.,
   all of them).
 
+Re-export Declaration
+~~
+An *export-as-declaration* specifies that the current module is a private
+module whose interface will be re-exported by the named public module.
+
+.. parsed-literal::
+
+  *export-as-declaration*:
+``export_as`` *identifier*
+
+The *export-as-declaration* names the public module that the current
+(private) module will be re-exported through. Only top-level modules
+can be re-exported, and any given module may only be re-exported
+through a single public module.
+
+**Example:** In the following example, the (private) module
+``MyFrameworkCore`` will be re-exported via the public module
+``MyFramework``:
+
+.. parsed-literal::
+
+  module MyFrameworkCore {
+export_as MyFramework
+  }
+
 Use declaration
 ~~~
 A *use-declaration* specifies another module that the current top-level module

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=313316=313315=313316=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Thu Sep 14 16:38:44 2017
@@ -674,6 +674,13 @@ def err_mmap_invalid_header_attribute_va
   "expected integer literal as value for header attribute '%0'">;
 def err_mmap_expected_header_attribute : Error<
   "expected a header attribute name ('size' or 'mtime')">;
+def err_mmap_conflicting_export_as : Error<
+  "conflicting re-export of module '%0' as '%1' or '%2'">;
+def warn_mmap_redundant_export_as : Warning<
+  "module '%0' already re-exported as '%1'">,
+  InGroup;
+def err_mmap_submodule_export_as : Error<
+  "only top-level modules can be re-exported as public">;
 
 def warn_auto_module_import : Warning<
   "treating #%select{include|import|include_next|__include_macros}0 as an "

Modified: cfe/trunk/include/clang/Basic/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=313316=313315=313316=diff
==
--- cfe/trunk/include/clang/Basic/Module.h (original)
+++ cfe/trunk/include/clang/Basic/Module.h Thu Sep 14 16:38:44 2017
@@ -99,6 +99,10 @@ public:
 
   /// \brief The name of the umbrella entry, as written in the module map.
   std::string UmbrellaAsWritten;
+
+  /// \brief The module through which entities defined in this module will
+  /// eventually be exposed, for use in "private" modules.
+  std::string ExportAsModule;
   
 private:
   /// \brief The submodules of this module, indexed by name.

Modified: