Commit 1b4db78
committed
[C++20] [Modules] Implement diagnose for exposured partially
Tracked at llvm#112294
This patch implements from [basic.link]p14 to [basic.link]p18 partially.
The explicitly missing parts are:
- Anything related to specializations.
- Decide if a pointer is associated with a TU-local value at compile
time.
- [basic.link]p15.1.2 to decide if a type is TU-local.
- Diagnose if TU-local functions from other TU are collected to the
overload set. See [basic.link]p19, the call to 'h(N::A{});' in
translation unit #2
There should be other implicitly missing parts as the wording uses
"names" briefly several times. But to implement this precisely, we have
to visit the whole AST, including Decls, Expression and Types, which may
be harder to implement and be more time-consuming for compilation time.
So I choose to implement the common parts.
It won't be too bad to miss some cases since we DIDN'T do any such
checks in the past 3 years. Any new check is an improvement. Given
modules have been basically available since clang15 without such checks,
it will be user unfriendly if we give a hard error now. And there are
a lot of cases which violating the rule actually just fine. So I decide
to emit it as warnings instead of hard errors.1 parent eb04b69 commit 1b4db78
File tree
8 files changed
+620
-0
lines changed- clang
- include/clang
- Basic
- Sema
- lib/Sema
- test
- CXX/basic/basic.link
- Modules
8 files changed
+620
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12391 | 12391 | | |
12392 | 12392 | | |
12393 | 12393 | | |
| 12394 | + | |
| 12395 | + | |
| 12396 | + | |
| 12397 | + | |
| 12398 | + | |
| 12399 | + | |
| 12400 | + | |
12394 | 12401 | | |
12395 | 12402 | | |
12396 | 12403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9945 | 9945 | | |
9946 | 9946 | | |
9947 | 9947 | | |
| 9948 | + | |
| 9949 | + | |
| 9950 | + | |
| 9951 | + | |
| 9952 | + | |
| 9953 | + | |
| 9954 | + | |
| 9955 | + | |
| 9956 | + | |
| 9957 | + | |
| 9958 | + | |
| 9959 | + | |
| 9960 | + | |
| 9961 | + | |
9948 | 9962 | | |
9949 | 9963 | | |
9950 | 9964 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1616 | 1616 | | |
1617 | 1617 | | |
1618 | 1618 | | |
| 1619 | + | |
| 1620 | + | |
1619 | 1621 | | |
1620 | 1622 | | |
1621 | 1623 | | |
| |||
0 commit comments