[all-commits] [llvm/llvm-project] 1b4db7: [C++20] [Modules] Implement diagnose for exposured...
Chuanqi Xu via All-commits
all-commits at lists.llvm.org
Sun Jul 27 19:00:00 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1b4db78d2eaa070b3f364a2d2b2b826a5439b892
https://github.com/llvm/llvm-project/commit/1b4db78d2eaa070b3f364a2d2b2b826a5439b892
Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: 2025-07-28 (Mon, 28 Jul 2025)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/Sema.cpp
M clang/lib/Sema/SemaModule.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
A clang/test/CXX/basic/basic.link/p19.cppm
A clang/test/Modules/Exposure-2.cppm
A clang/test/Modules/Exposure.cppm
Log Message:
-----------
[C++20] [Modules] Implement diagnose for exposured partially
Tracked at https://github.com/llvm/llvm-project/issues/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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list