This is an archive of the discontinued LLVM Phabricator instance.

[libc++][modules] Avoids duplicated exports.
ClosedPublic

Authored by Mordante on Jul 7 2023, 8:58 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGc62e88eeef2d: [libc++][modules] Avoids duplicated exports.
Summary

The first issue was found by @ldionne, upon further investigation there
were more duplicates. This removes the duplicates and updates the
clang-tidy test to detect duplicates.

Diff Detail

Event Timeline

Mordante created this revision.Jul 7 2023, 8:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2023, 8:58 AM
Mordante requested review of this revision.Jul 7 2023, 8:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2023, 8:58 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Jul 7 2023, 2:22 PM

LGTM but I'd like to understand how the test will fail.

libcxx/modules/std/cmath.cppm
142–143

Is this comment in the right place now?

libcxx/modules/std/filesystem.cppm
38–39

Same.

libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
236

This might be dumb, but I don't understand how the test will fail. Can you explain a bit more?

This revision is now accepted and ready to land.Jul 7 2023, 2:22 PM
Mordante marked 3 inline comments as done.Jul 8 2023, 4:19 AM
Mordante added inline comments.
libcxx/modules/std/cmath.cppm
142–143

I tend to keep the empty sections in other modules too,

libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
236

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.

This revision was landed with ongoing or failed builds.Jul 8 2023, 4:19 AM
This revision was automatically updated to reflect the committed changes.
Mordante marked 2 inline comments as done.