[PATCH] D128328: [C++20][Modules] Improve handing of Private Module Fragment diagnostics.

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 01:50:24 PDT 2022


ChuanqiXu added a comment.

It looks like we need to handle inline variable as well to match the intention.



================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:11155
+def err_export_inline_not_defined : Error<
+  "exported inline functions must be defined within the module purview"
+  " and before any private module fragment">;
----------------
>From my reading, 'exported' is not emphasized.


================
Comment at: clang/lib/Sema/SemaModule.cpp:895-905
+      if (auto *FD = dyn_cast<FunctionDecl>(Child)) {
+        // [dcl.inline]/7
+        // If an inline function or variable that is attached to a named module
+        // is declared in a definition domain, it shall be defined in that
+        // domain.
+        // So, if the current declaration does not have a definition, we must
+        // check at the end of the TU (or when the PMF starts) to see that we
----------------
So we might need to move this to somewhere else.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128328



More information about the cfe-commits mailing list