[libcxx-commits] [PATCH] D154723: [libc++][modules] Avoids duplicated exports.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 8 04:19:11 PDT 2023


Mordante marked 3 inline comments as done.
Mordante added inline comments.


================
Comment at: libcxx/modules/std/cmath.cppm:142
 
   // [c.math.hypot3], three-dimensional hypotenuse
 
----------------
ldionne wrote:
> Is this comment in the right place now?
I tend to keep the empty sections in other modules too,


================
Comment at: libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp:236
+        // After the warning the script continues.
+        // The test will fail since modules have duplicated entries and headers not.
+        llvm::errs() << "Duplicated export of '" << name << "'.\n";
----------------
ldionne wrote:
> This might be dumb, but I don't understand how the test will fail. Can you explain a bit more?
Assume `foo.h`
```
void foo(char);
void foo(int);
```
This will only list one named declaration since duplicates are removed.
```
using ::foo;
```

`foo.ccpm`
```
export {
using ::foo;
using ::foo;
}
```
This will list two named declarations since duplicates are *not* removed.
```
using ::foo;
using ::foo;
```
Now the header and the module generate different output and are not considered "the same". This fails. This is the same failure when a public named declaration is added to a header and not to the module.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154723/new/

https://reviews.llvm.org/D154723



More information about the libcxx-commits mailing list