[libcxx-commits] [PATCH] D156594: [libc++][modules] Improves export validation.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 31 09:39:14 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbae14bcd1d9e: [libc++][modules] Improves export validation. (authored by Mordante).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156594/new/
https://reviews.llvm.org/D156594
Files:
libcxx/test/libcxx/module_std.gen.py
libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
Index: libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
===================================================================
--- libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -228,6 +228,11 @@
if (clang::Module* M = decl->getOwningModule(); M && M->Kind != clang::Module::ModulePartitionInterface)
return;
+ // For module partitions only take exported declarations.
+ if (file_type_ == FileType::ModulePartition)
+ if (decl->getModuleOwnershipKind() != clang::Decl::ModuleOwnershipKind::VisibleWhenImported)
+ return;
+
if (decls_.contains(name)) {
// For modules avoid exporting the same named declaration twice. For
// header files this is common and valid.
Index: libcxx/test/libcxx/module_std.gen.py
===================================================================
--- libcxx/test/libcxx/module_std.gen.py
+++ libcxx/test/libcxx/module_std.gen.py
@@ -225,3 +225,10 @@
# Compare the sum of the parts with the main module.
print(f"// RUN{BLOCKLIT}: diff -u %t.all_partitions %t.module")
+
+# Basic smoke test. Import a module and try to compile when using all
+# exported names. This validates the clang-tidy script does not accidentally
+# add named declarations to the list that are not available.
+print(f"// RUN{BLOCKLIT}: echo 'import std;' > %t.compile.pass.cpp")
+print(f"// RUN{BLOCKLIT}: cat %t.all_partitions >> %t.compile.pass.cpp")
+print(f"// RUN{BLOCKLIT}: %{{cxx}} %{{flags}} %{{compile_flags}} -fsyntax-only %t.compile.pass.cpp")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156594.545713.patch
Type: text/x-patch
Size: 1634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230731/496a02b3/attachment.bin>
More information about the libcxx-commits
mailing list