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

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 02:18:05 PDT 2022


iains added a comment.

In D128328#3603980 <https://reviews.llvm.org/D128328#3603980>, @ChuanqiXu wrote:

> 



>>> Also, **if** [module.private.frag]p2.1 is changed into:
>>>
>>>> the point by which the definition of an [exported] inline function or variable is required
>>>
>>> The test above would cover this too.
>>>
>>> BTW, it shows we could lack test like:
>>>
>>>   export module A;
>>>   [export] inline void func(); // no definition in the definition domain
>>
>> I think the current impl. should catch that - the only difference would be that, in the case there's a definition in the PMF, there would be a note about the unreachable definition.
>
> It looks like the current impl doesn't catch this: https://godbolt.org/z/fh9Ehfdj5 . I think I don't make mistake this time since a function declaration without function body shouldn't be a definition.

Right, that should be an error - we do not have a test for it. 
ActOnEndOfTranslationUnitFragment should be called with "Kind =TUFragmentKind::Normal" whether there us a PMF or not.
https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/Sema.cpp#L1131
so - modulo the underlying question about 'export' we probably just need a section test-case
(we could still defer the processing to the end of the TU and implement the error messages as suggested by @vsapsai )


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