[C++20] [Modules] Remove assertion of current module when acting on import
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Sat, 8 Oct 2022 08:38:19 +0000 (16:38 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Sat, 8 Oct 2022 08:44:51 +0000 (16:44 +0800)
commit9974ed804995d2e34be69404e9904c7e03cfbda4
tree743108d7d75d590515529d3bd124f21d668130a6
parent566c277c64f8f76d8911aa5fd931903a357ed7be
[C++20] [Modules] Remove assertion of current module when acting on import

Closes https://github.com/llvm/llvm-project/issues/58199

Previously, when we act on a import statement, we'll assume there is a
module declaration in the current TU if the command line tells us we're
compiling a module unit. This makes since on valid codes. However, for
invalid codes, it is possible. See
https://github.com/llvm/llvm-project/issues/58199 for example.

This patch removes the assertion. And the assertion is a noop and it
should be safe to remove it.
clang/lib/Sema/SemaModule.cpp
clang/test/Modules/missing-module-declaration.cppm [new file with mode: 0644]