[C++20] [Modules] Don't create multiple global module fragment
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 8 Feb 2022 03:50:57 +0000 (11:50 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 8 Feb 2022 03:52:09 +0000 (11:52 +0800)
commit3504937dfb2b7d90b2c3b3c7b28c472d31489007
treebd149b3e1d54394be7b0cf3c0a1428feaf882bba
parente39ba0461757339f7172f6bc3882f41116bb7c13
[C++20] [Modules] Don't create multiple global module fragment

Since the serialization code would recognize modules by names and the
name of all global module fragment is <global>, so that the
serialization code would complain for the same module.

This patch fixes this by using a unique global module fragment in Sema.
Before this patch, the compiler would fail on an assertion complaining
the duplicated modules.

Reviewed By: urnathan, rsmith

Differential Revision: https://reviews.llvm.org/D115610
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaModule.cpp
clang/test/CXX/module/module.unit/p7/Inputs/h8.h [new file with mode: 0644]
clang/test/CXX/module/module.unit/p7/Inputs/m8.cppm [new file with mode: 0644]
clang/test/CXX/module/module.unit/p7/t8.cpp [new file with mode: 0644]