[clang] [C++20] [Modules] Introduce -fskip-odr-check-in-gmf (PR #79959)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 30 00:02:13 PST 2024
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 dc4483659fc51890fdc732acc66a4dcda6e68047 046ec7d3e8f509d830e2e6081d697415859811c2 -- clang/test/Driver/modules-skip-odr-check-in-gmf.cpp clang/test/Modules/skip-odr-check-in-gmf.cppm clang/include/clang/Serialization/ASTReader.h clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/test/Modules/concept.cppm clang/test/Modules/polluted-operator.cppm clang/test/Modules/pr76638.cppm
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 0263ebd6b6..cd28226c29 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -2453,7 +2453,8 @@ private:
};
inline bool shouldSkipCheckingODR(const Decl *D) {
- return D->getOwningModule() && D->getASTContext().getLangOpts().SkipODRCheckInGMF &&
+ return D->getOwningModule() &&
+ D->getASTContext().getLangOpts().SkipODRCheckInGMF &&
D->getOwningModule()->isExplicitGlobalModule();
}
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 0fad0b8940..ffba04f287 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -831,7 +831,8 @@ void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
Reader.mergeDefinitionVisibility(OldDef, ED);
// We don't want to check the ODR hash value for declarations from global
// module fragment.
- if (!shouldSkipCheckingODR(ED) && OldDef->getODRHash() != ED->getODRHash())
+ if (!shouldSkipCheckingODR(ED) &&
+ OldDef->getODRHash() != ED->getODRHash())
Reader.PendingEnumOdrMergeFailures[OldDef].push_back(ED);
} else {
OldDef = ED;
@@ -3520,8 +3521,8 @@ ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(NamedDecl *D) {
// FIXME: We should do something similar if we merge two definitions of the
// same template specialization into the same CXXRecordDecl.
auto MergedDCIt = Reader.MergedDeclContexts.find(D->getLexicalDeclContext());
- if (MergedDCIt != Reader.MergedDeclContexts.end() && !shouldSkipCheckingODR(D) &&
- MergedDCIt->second == D->getDeclContext())
+ if (MergedDCIt != Reader.MergedDeclContexts.end() &&
+ !shouldSkipCheckingODR(D) && MergedDCIt->second == D->getDeclContext())
Reader.PendingOdrMergeChecks.push_back(D);
return FindExistingResult(Reader, D, /*Existing=*/nullptr,
``````````
</details>
https://github.com/llvm/llvm-project/pull/79959
More information about the cfe-commits
mailing list