[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
Thu Jun 23 02:57:34 PDT 2022


ChuanqiXu added a comment.

In D128328#3604110 <https://reviews.llvm.org/D128328#3604110>, @iains wrote:

> 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

I don't understand the intention of the suggestion. I feel like the current one looks right.

> so - modulo the underlying question about 'export' we probably just need a second test-case

Agreed.

> (we could still defer the processing to the end of the TU and implement the error messages as suggested by @vsapsai )

Oh, the intention of your suggestion is to implement the suggestion by @vsapsai, right? If it is, I would like to suggest to move the processing of PendingInlineExports  to ActOnEndOfTranslationUnit instead of change the argument of ActOnEndOfTranslationUnitFragment.


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