Commit Graph

27 Commits

Author SHA1 Message Date
Richard Smith 0a088ead85 Improve diagnostics for missing import / #include of module.
Fix a few bugs where we would fail to properly determine header to
module correspondence when determining whether to suggest a #include or
import, and suggest a #include more often in language modes where there
is no import syntax. Generally, if the target is in a header with
include guards or #pragma once, we should suggest either #including or
importing that header, and not importing a module that happens to
textually include it.

In passing, improve the notes we attach to the corresponding
diagnostics: calling an entity that we couldn't see "previous" is
confusing.
2020-04-28 18:41:14 -07:00
Richard Smith e181de7f4f [c++2a] Implement semantic restrictions for 'export' declarations.
llvm-svn: 358932
2019-04-22 22:50:11 +00:00
Richard Smith a5bbbfef15 [c++2a] Add semantic support for private module fragments.
llvm-svn: 358713
2019-04-18 21:12:54 +00:00
Richard Smith d652bdd05f [c++20] Parsing support for module-declarations, import-declarations,
and the global and private module fragment.

For now, the private module fragment introducer is ignored, but use of
the global module fragment introducer should be properly enforced.

llvm-svn: 358353
2019-04-14 08:06:59 +00:00
Rafael Espindola 922f2aa9b2 Bring r325915 back.
The tests that failed on a windows host have been fixed.

Original message:

Start setting dso_local for COFF.

With this there are still some GVs where we don't set dso_local
because setGVProperties is never called. I intend to fix that in
followup commits. This is just the bare minimum to teach
shouldAssumeDSOLocal what it should do for COFF.

llvm-svn: 325940
2018-02-23 19:30:48 +00:00
Hamza Sood 81fe14e4c3 [Modules TS] Added module re-export support.
This implements [dcl.modules.export] from the C++ Modules TS, which lets a module re-export another module with the "export import" syntax.
Differential Revision: https://reviews.llvm.org/D40270

llvm-svn: 318744
2017-11-21 09:42:42 +00:00
Richard Smith 18057cb34c [Modules TS] Diagnose missing/duplicate module-declaration.
llvm-svn: 315397
2017-10-11 00:36:56 +00:00
Richard Smith d97d35e150 [Modules TS] Diagnose attempts to enter module implementation units without the module interface being available.
llvm-svn: 315381
2017-10-10 22:35:27 +00:00
Richard Smith becb92dec8 [Modules TS] Module ownership semantics for redeclarations.
When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

This reinstates r315251 and r315256, reverted in r315309 and r315308
respectively, tweaked to avoid triggering a linkage calculation when declaring
implicit special members (this exposed our pre-existing issue with typedef
names for linkage changing the linkage of types whose linkage has already been
computed and cached in more cases). A testcase for that regression has been
added in r315366.

llvm-svn: 315379
2017-10-10 22:33:17 +00:00
Eric Liu f01516db8d Revert "[Modules TS] Module ownership semantics for redeclarations."
This reverts commit r315251. See the original commit thread for reason.

llvm-svn: 315309
2017-10-10 13:09:40 +00:00
Richard Smith b87720b77a [Modules TS] Module ownership semantics for redeclarations.
When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

llvm-svn: 315251
2017-10-09 23:42:09 +00:00
Richard Smith f26c54f9ce Add target triple to improve the happiness of MSVC buildbots.
llvm-svn: 312749
2017-09-07 22:07:52 +00:00
Richard Smith 80acd0fd0b [modules ts] Add test for [basic.link]p3.
llvm-svn: 312696
2017-09-07 05:29:39 +00:00
Richard Smith cd4a7a461f [modules ts] Ensure that module linkage variables are always emitted and always have their name mangled.
llvm-svn: 312684
2017-09-07 00:55:55 +00:00
Richard Smith a465362d77 [modules ts] Emit global variables in a module interface unit as part of that unit, not in importers.
llvm-svn: 312665
2017-09-06 20:01:14 +00:00
Richard Smith dd8b5337e9 Implement Itanium name mangling support for C++ Modules TS.
This follows the scheme agreed with Nathan Sidwell, which can be found here:

  https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile

This will be proposed to the itanium-cxx-abi list once we have some experience
with how well it works; the ABI for this TS should be considered unstable until
it is part of the Itanium C++ ABI.

llvm-svn: 312467
2017-09-04 05:37:53 +00:00
Boris Kolpackov d30446fd77 [modules] Add ability to specify module name to module file mapping (reapply)
Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D35020

llvm-svn: 312220
2017-08-31 06:26:43 +00:00
Boris Kolpackov b83213e1c9 Fix path regex in test to match on Windows
llvm-svn: 312217
2017-08-31 06:18:08 +00:00
Victor Leschuk db68911b07 Revert r312105 [modules] Add ability to specify module name to module file mapping
Looks like it breaks win10 builder.

llvm-svn: 312112
2017-08-30 11:31:56 +00:00
Boris Kolpackov 7a71b4b658 [modules] Add ability to specify module name to module file mapping
Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D35020

llvm-svn: 312105
2017-08-30 08:45:59 +00:00
Boris Kolpackov 734d8548ee [modules-ts] Omit submodule semantics for TS modules
If a TS module name has more than one component (e.g., foo.bar) then we
erroneously activated the submodule semantics when encountering a module
declaration in the module implementation unit (e.g., 'module foo.bar;').

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D35678

llvm-svn: 312007
2017-08-29 15:30:18 +00:00
Richard Smith 1283e9868d [modules ts] Basic for module linkage.
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.

llvm-svn: 307434
2017-07-07 20:04:28 +00:00
Richard Smith b51cf1136f [modules ts] Do not emit strong function definitions from the module interface unit in every user.
llvm-svn: 307232
2017-07-06 00:30:00 +00:00
Richard Smith d19389a3c9 [modules ts] Improve merging of module-private declarations.
These cases occur frequently for declarations in the global module (above the
module-declaration) in a Modules TS module interface. When we merge a
definition from another module into such a module-private definition, ensure
that we transitively make everything lexically within that definition visible
to that translation unit.

llvm-svn: 307129
2017-07-05 07:47:11 +00:00
Richard Smith e03a654581 [modules ts] Declarations from a module interface unit are only visible outside
the module if declared in an export block. 

llvm-svn: 307115
2017-07-05 01:42:07 +00:00
Richard Smith 145e15a37b [modules ts] Diagnose 'export' declarations outside of a module interface.
llvm-svn: 301271
2017-04-24 23:12:30 +00:00
Richard Smith 645386cf4b Rearrange some Modules TS testcases into test/CXX/modules-ts.
llvm-svn: 301066
2017-04-22 00:47:53 +00:00