[all-commits] [llvm/llvm-project] b37233: [C++20][Modules] Complete implementation of module...

Iain Sandoe via All-commits all-commits at lists.llvm.org
Sun Jun 25 00:34:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b37233a253f30e4bd5f040d598826df443293bee
      https://github.com/llvm/llvm-project/commit/b37233a253f30e4bd5f040d598826df443293bee
  Author: Iain Sandoe <iain at sandoe.co.uk>
  Date:   2023-06-25 (Sun, 25 Jun 2023)

  Changed paths:
    M clang/include/clang/Basic/Module.h
    M clang/lib/Basic/Module.cpp
    M clang/lib/Sema/SemaModule.cpp
    M clang/test/CXX/module/basic/basic.def.odr/p6.cppm
    A clang/test/CXX/module/module.import/p7.cpp

  Log Message:
  -----------
  [C++20][Modules] Complete implementation of module.import p7.

The following test fails to compile TU b.cpp because we are not making the transitively imported modules visible (per [module.import]/p7)

```
a.cppm:
export module a;

export int foo() {
   return 42;
}

b.cppm:
export module b;
import a;

export int bar();

b.cpp:
module b;

int bar() {
   return foo();
}

clang++ -c -std=c++2b -fmodule-output a.cppm
clang++ -c -std=c++2b -fmodule-output -fprebuilt-module-path=. b.cppm
clang++ -c -std=c++2b -fprebuilt-module-path=. b.cpp
b.cpp:4:12: error: declaration of 'foo' must be imported from module 'a' before it is required
   return foo();
```

This is fixed by the following patch (which also addresses a FIXME in basic.def.odr/p6.cppm).

Differential Revision: https://reviews.llvm.org/D152746




More information about the All-commits mailing list