Commit Graph
33 Commits
Author SHA1 Message Date
Chuanqi Xu b014944e47 [NFC] [doc] Mentioning to include the guard headers from imported modules 2024-02-23 16:54:13 +08:00
Chuanqi Xu c8fab880fa [docs] [C++20] [Modules] Ideas for transitioning to modules (#80687)
This patch tries to provide some ideas to transform an existing
libraries to modules. I feel this is helpful for users who is interested
in modules from my observation. While the syntax of modules look easy to
understand, the practice gets harder if the users want to make
compatible work with headers. Especially the `std` module can be
installed in clang18, I think such document may be helpful.

I tried to not be too wordy in this document and I don't want the users
to have impressions that they have to follow this or this is the best
practice. So I tried to use the term `idea` imply the users this is not
compulsory.

I add some regular reviewers for modules, but review opinions from users
are highly recommended.

I want to land this before the releasing of clang18 (in the early
March). We can and should improve this continuously.
2024-02-20 13:29:34 +08:00
Chuanqi Xu 8eea582dcb [C++20] [Modules] Introduce -fskip-odr-check-in-gmf (#79959)
Close https://github.com/llvm/llvm-project/issues/79240

Cite the comment from @mizvekov in
//github.com/llvm/llvm-project/issues/79240:

> There are two kinds of bugs / issues relevant here:
>
> Clang bugs that this change hides
> Here we can add a Frontend flag that disables the GMF ODR check, just
> so
> we can keep tracking, testing and fixing these issues.
> The Driver would just always pass that flag.
> We could add that flag in this current issue.
> Bugs in user code:
> I don't think it's worth adding a corresponding Driver flag for
> controlling the above Frontend flag, since we intend it's behavior to
> become default as we fix the problems, and users interested in testing
> the more strict behavior can just use the Frontend flag directly.

This patch follows the suggestion:
- Introduce the CC1 flag `-fskip-odr-check-in-gmf` which is by default
off, so that the every existing test will still be tested with checking
ODR violations.
- Passing `-fskip-odr-check-in-gmf` in the driver to keep the behavior
we intended.
- Edit the document to tell the users who are still interested in more
strict checks can use `-Xclang -fno-skip-odr-check-in-gmf` to get the
existing behavior.
2024-02-01 13:44:32 +08:00
Chuanqi Xu bae1adae1c [docs] [C++20] [Modules] Document how to import modules in clang-repl
We support to import C++20 named modules now in in clang-repl in
https://github.com/llvm/llvm-project/commit/dd3e6c87f3f4affd17d05a4d25fa77d224a98d94.

Then we should document how can we do that.
2024-01-24 16:14:14 +08:00
Chuanqi Xu a31a600747 [docs] Update StandardCPlusPlusModules.rst with clang18
Changed Things:
- Mentioning we need to specify BMIs for indirectly dependent BMIs too.
- Remove the note for `delayed-template-parsing` since
  https://github.com/llvm/llvm-project/issues/61068 got closed.
- Add a note for https://github.com/llvm/llvm-project/issues/78850 since
  we've seen it for a lot of times.
- Add a note for https://github.com/llvm/llvm-project/issues/78173 since
  we've seen it for a lot of times.
2024-01-22 14:24:33 +08:00
Chuanqi Xu 4b99af3419 [docs] Update doc for C++20 Modules after dc4e85b
After
https://github.com/llvm/llvm-project/commit/dc4e85bd79ff17014cbbe4a9db1d9b91929e91ce,
we need to update the examples in the documents.

This patch also fix some other places where is no longer relevant.
2024-01-12 14:16:19 +08:00
Chuanqi Xu 22043643c6 [docs] [C++20] [Modules] Add document for the case of duplicated '-fmodule-file=<module-name>='
This patch clarifies that in case there are multiple
'-fmodule-file=<module-name>=' optins for the same `<module-name>`,
the last '-fmodule-file=<module-name>=' will override the previous
'-fmodule-file=<module-name>=' option.
2023-10-30 11:25:21 +08:00
Chuanqi Xu be72dca5e3 [docs] [C++20] [Modules] Mentioning that -fdelayed-template-parsing is not working with modules
Catched in https://github.com/llvm/llvm-project/issues/61068.

Add this to the document to avoid further misunderstandings.
2023-10-16 10:38:33 +08:00
Mark de Wever c73de29691 [clang][doc] Mentions -Wno-reserved-module-identifiers
This is a nicer way to suppress the diagnostic instead of using the
pre-processor work-around.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D158523
2023-08-23 18:31:29 +02:00
Chuanqi Xu f6b94e0026 [NFC] Document the solution to pr61006 and a test for it
Address https://github.com/llvm/llvm-project/issues/61006.

The actual reason for the issue is about the usage of clang-scan-deps
instead of its functionalities since clang-scan-deps has
already considered the problem before for clang modules.

So this patch tries to document the corresponding solution
and add a test case for it to address the issue.
2023-08-11 14:57:32 +08:00
Chuanqi Xu 3b48613f2d [docs] [C++20] [Modules] Mark the compatiblity issue within clang-cl.exe
See
https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257
for details. Simply, the user of clang-cl.exe can't get a good
experience with C++20 modules now. While we don't have resources to
support it well now, we should make it clear in the documentation.
2023-07-26 15:06:13 +08:00
Chuanqi Xu 5e601ad3bc [NFC] Add a blank line after directives in StandardCPlusPlusModules.rst 2023-07-19 16:10:55 +08:00
Chuanqi Xu 0d6ea6fc3b [NFC] [C++20] [Modules] Add a performance tip to the document
It is a known problem that the compiler isn't efficiency when there are
a lot of duplications in the modules to developers. But it may not be
verbose to the (potential) new users of C++20 modules.

It may be necessary to mention this in the document.
2023-07-19 15:49:56 +08:00
Nikolas Klauser f6d557ee34 [clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs
A lot of editors remove trailing whitespaces. This patch removes any trailing whitespaces and makes sure that no new ones are added.

Reviewed By: erichkeane, paulkirth, #libc, philnik

Spies: wangpc, aheejin, MaskRay, pcwang-thead, cfe-commits, libcxx-commits, dschuff, nemanjai, arichardson, kbarton, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, s.egerton, sameer.abuasal, apazos, luismarques, martong, frasercrmck, steakhal, luke

Differential Revision: https://reviews.llvm.org/D151963
2023-06-26 09:34:36 -07:00
Kazu Hirata 2db0812882 [clang] Fix typos in documentation 2023-05-12 23:19:17 -07:00
Chuanqi Xu 7adf3849e4 [docs] [C++20] [Modules] Remove the section 'Source content consistency'
Since the C++20 named modules won't check source files consistency after
5b388f8, it would be better to remove this section in the document.
2023-05-10 09:59:50 +08:00
Mark de Wever ba15d186e5 [clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.

This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.

Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149553
2023-05-04 19:19:52 +02:00
Chuanqi Xu 20d9aa1a43 [doc] [C++20] [Modules] Document that the interfaces of header units is experimental
Close https://github.com/llvm/llvm-project/issues/62241

In tooling group (SG15), it is still unclear how tools should support
header units. Add a warning in the documentation to avoid further
confusions.
2023-04-21 10:43:24 +08:00
Chuanqi Xu 1b5980997b [C++20] [Modules] Don't create duplicated deduction guides for duplicated classes
Close https://github.com/llvm/llvm-project/issues/56916

Within C++20 modules, we may have multiple same constructors in
multiple same RecordDecls. And it doesn't make sense naturally to create
duplicated deduction guides for the duplicated constructors.
2023-03-28 17:51:38 +08:00
Chuanqi Xu 684955a230 [Modules] [doc] Document the problem that we can't include headers before import declarations 2023-03-17 15:10:37 +08:00
Chuanqi Xu e264fe89e3 [doc] [Modules] Document how to implement ABI compatible code in module units 2023-03-13 16:44:10 +08:00
Chuanqi Xu 1c33c419e4 [doc] Deprecate the '-fmodule-file=<module-name>=<path-BMI>' for named modules in the document
The option '-fmodule-file=<module-name>=<path-BMI>' is already
deprecated now. This patch mentions it in the document.
2023-03-09 16:20:01 +08:00
Mark de Wever 8dbeb41f8e [clang] Documents clang-scan-deps requirements.
This was discussed in https://llvm.org/PR61006.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D144894
2023-02-28 18:16:28 +01:00
Mark de Wever a7b6978285 [clang][doc] Removes obsolete comment.
After reading about the documentation improvements on LLVM weekly this
part seems obsolete.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D144497
2023-02-22 17:17:36 +01:00
Chuanqi Xu 9c4f0d83f6 [docs] Add document for clang-scan-deps -format=p1689
The patches for `clang-scan-deps` have been landed. And we need to
document the behavior then.
2023-02-14 14:00:12 +08:00
Chuanqi Xu 1782e8f9e8 [C++20] [Modules] Allow -fmodule-file=<module-name>=<BMI-Path> for implementation unit and document the behavior
Close https://github.com/llvm/llvm-project/issues/57293.

Previsouly we can't use `-fmodule-file=<module-name>=<BMI-Path>` for
implementation units, it is a bug. Also the behavior of the above option
is not tested nor documented for C++20 Modules. This patch addresses the
2 problems.
2023-02-08 16:45:00 +08:00
Mark de Wever c8d16bf304 [clang][doc] Fixes formatting of a text block. 2023-01-22 16:21:11 +01:00
Chuanqi Xu 046a9910c3 Add Release Notes and Doc for -fmodule-output
As the summary explained in https://reviews.llvm.org/D137058,
the design of `-fmodule-output` changes relatively frequently
so I skipped the release notes and docs for -fmodule-output in the
the patches. And the patches get accepted and landed. The patch adds
the related release notes and docs.
2023-01-16 17:01:41 +08:00
Chuanqi Xu de034cf313 [NFC] Fix the typo and the format in the StandardCPlusPlusModules
document
2022-11-15 22:53:43 +08:00
Chuanqi Xu 04fb3e3de7 [C++20] [Modules] Document the behavior about reserved module names
We would diagnose about the reserved names in b8ceb9f4e4. And the
patch documents about the related behaviors.
2022-11-10 16:43:50 +08:00
Chuanqi Xu e12b627a35 [docs] Add the description about mixing use of clang modules and c++
modules

From the discussion in
https://discourse.llvm.org/t/how-should-we-support-dependency-scanner-for-c-20-modules/66027,
we get a consensus that we want to support clang modules and c++ modules
at the same time. This patch documents this intention.

Reviewed By: bruno

Differential Revision: https://reviews.llvm.org/D136221
2022-10-31 16:02:43 +08:00
Chuanqi Xu baa9eae279 [NFC] fix incorrect indentation in docs 2022-09-05 11:05:23 +08:00
Chuanqi Xu b1d5af8124 [docs] Add "Standard C++ Modules"
We get some standard C++ module things done in clang15.x. But we lack a
user documentation for it. The implementation of standard C++ modules
share a big part of codes with clang modules. But they have very
different semantics and user interfaces, so I think it is necessary to
add a document for Standard C++ modules. Previously, there were also
some people ask the document for standard C++ Modules and I couldn't
offer that time.

Reviewed By: iains, Mordante, h-vetinari, ruoso, dblaikie, JohelEGP,
aaronmondal

Differential Revision: https://reviews.llvm.org/D131388
2022-08-31 11:09:46 +08:00