[PATCH] D145965: [C++20][Modules] Fix incorrect visibilities in implementation units.

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 31 01:46:46 PDT 2023


ChuanqiXu added a comment.

Just took a quick look.



================
Comment at: clang/lib/Sema/SemaLookup.cpp:2082
+    Module *DeclModule = SemaRef.getOwningModule(D);
+    if (DeclModule && !DeclModule->isModuleMapModule() &&
+        !SemaRef.isModuleUnitOfCurrentTU(DeclModule) &&
----------------
We should check header units here.


================
Comment at: clang/lib/Sema/SemaLookup.cpp:2101
+  if (isVisible(SemaRef, ND)) {
+    if (SemaRef.getLangOpts().CPlusPlusModules && ND->isFromASTFile()) {
+      // The module that owns the decl is visible; However
----------------
Let's not use `isFromASTFile()`. It is a low level API without higher level semantics. I think it is good enough to check the module of ND.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145965/new/

https://reviews.llvm.org/D145965



More information about the cfe-commits mailing list