[clang] [C23] Implement WG14 N3037 (PR #132939)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 07:02:54 PDT 2025
================
@@ -450,6 +453,41 @@ class StmtComparer {
};
} // namespace
+static bool
+CheckStructurallyEquivalentAttributes(StructuralEquivalenceContext &Context,
+ const Decl *D1, const Decl *D2,
+ const Decl *PrimaryDecl = nullptr) {
+ // If either declaration has an attribute on it, we treat the declarations
+ // as not being structurally equivalent.
+ // FIXME: this should be handled on a case-by-case basis via tablegen in
+ // Attr.td. There are multiple cases to consider: one declation with the
+ // attribute, another without it; different attribute syntax|spellings for
+ // the same semantic attribute, differences in attribute arguments, order
+ // in which attributes are applied, how to merge attributes if the types are
+ // structurally equivalent, etc.
+ const Attr *D1Attr = nullptr, *D2Attr = nullptr;
----------------
erichkeane wrote:
TBH it might be nice to 'as a framework' factor this in a way to allow ONE hard-coded attribute to be equivalent. We could pick something harmless (like `deprecated`).
So this instead of "any attribute present" becomes "any unsupported/thought of attribute" (of which we've only thought of 1 harmless one).
THOUGH in the case of `deprecated`, we probably want to warn that the 2nd one is ignored...
so maybe... eh.
https://github.com/llvm/llvm-project/pull/132939
More information about the cfe-commits
mailing list