[clang] [C++20] [Modules] Don't generate call to an imported module that dont init anything (PR #67638)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 00:49:00 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0e8a8c85f8765c086c573f36e60c895920381e18 2448304b847da467a2a81c33daa7fb789948edf1 -- clang/include/clang/Basic/Module.h clang/lib/Basic/Module.cpp clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/Sema/Sema.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/CodeGenCXX/module-initializer-guard-elision.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h
index fc8c39719979..b6303cb54b94 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -600,9 +600,7 @@ public:
return Kind == ModuleInterfaceUnit || Kind == ModulePartitionInterface;
}
- bool isNamedModuleInterfaceNoInit() const {
- return NamedModuleNoInit;
- }
+ bool isNamedModuleInterfaceNoInit() const { return NamedModuleNoInit; }
/// Get the primary module interface name from a partition.
StringRef getPrimaryModuleInterfaceName() const {
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index d2a7fcb0ee27..faecaa755f1b 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1246,8 +1246,9 @@ void Sema::ActOnEndOfTranslationUnit() {
}
// Now we can decide whether the modules we're building need an initializer.
- if (Module *CurrentModule = getCurrentModule(); CurrentModule && CurrentModule->isInterfaceOrPartition()) {
- auto DoesModNeedInit = [this] (Module *M) {
+ if (Module *CurrentModule = getCurrentModule();
+ CurrentModule && CurrentModule->isInterfaceOrPartition()) {
+ auto DoesModNeedInit = [this](Module *M) {
if (!getASTContext().getModuleInitializers(M).empty())
return false;
for (auto [Exported, _] : M->Exports)
``````````
</details>
https://github.com/llvm/llvm-project/pull/67638
More information about the cfe-commits
mailing list