[C++20] [Module] Support reachable definition initially/partially
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 29 Jun 2022 04:48:48 +0000 (12:48 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 29 Jun 2022 04:48:48 +0000 (12:48 +0800)
commit9c04851cf5809c80862183481f8ced0b3e9ee301
treea33ee8c379a0eea3debb182610168cb154b8579b
parent7a541406b5a23a811a4f37432292a6de3307b0f1
[C++20] [Module] Support reachable definition initially/partially

This patch introduces a new kind of ModuleOwnershipKind as
ReachableWhenImported. This intended the status for reachable described
at: https://eel.is/c++draft/module.reach#3.

Note that this patch is not intended to support all semantics about
reachable semantics. For example, this patch didn't implement discarded
declarations in GMF. (https://eel.is/c++draft/module.global.frag#3).

This fixes: https://bugs.llvm.org/show_bug.cgi?id=52281 and
https://godbolt.org/z/81f3ocjfW.

Reviewed By: rsmith, iains

Differential Revision: https://reviews.llvm.org/D113545
39 files changed:
clang/include/clang/AST/DeclBase.h
clang/include/clang/Basic/Module.h
clang/include/clang/Sema/Lookup.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Decl.cpp
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaModule.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4-friend-in-reachable-class.cpp [new file with mode: 0644]
clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
clang/test/CXX/module/module.context/p7.cpp [new file with mode: 0644]
clang/test/CXX/module/module.import/p2.cpp
clang/test/CXX/module/module.interface/p2.cpp
clang/test/CXX/module/module.interface/p7.cpp [new file with mode: 0644]
clang/test/CXX/module/module.reach/ex1.cpp [new file with mode: 0644]
clang/test/CXX/module/module.reach/p2.cpp [new file with mode: 0644]
clang/test/CXX/module/module.reach/p4/TransitiveImport.cpp [new file with mode: 0644]
clang/test/CXX/module/module.reach/p5.cpp [new file with mode: 0644]
clang/test/CXX/module/module.unit/p7/t6.cpp
clang/test/CXX/modules-ts/basic/basic.link/p2/other.cpp
clang/test/Modules/Reachability-Private.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-func-default-arg.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-func-ret.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-template-default-arg.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-template-instantiation.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-using-templates.cpp [new file with mode: 0644]
clang/test/Modules/Reachability-using.cpp [new file with mode: 0644]
clang/test/Modules/cxx20-10-1-ex2.cpp
clang/test/Modules/derived_class.cpp [new file with mode: 0644]
clang/test/Modules/explicitly-specialized-template.cpp [new file with mode: 0644]
clang/test/Modules/module-private.cpp
clang/test/Modules/template-function-specialization.cpp [new file with mode: 0644]
clang/test/Modules/template_default_argument.cpp [new file with mode: 0644]