From 3c1e89b0f29e5f95bb313ffd914e9ae113e33ea8 Mon Sep 17 00:00:00 2001 From: Allan Shortlidge Date: Wed, 30 Jul 2025 12:56:55 -0700 Subject: [PATCH] Suppress warnings for Swift C++ interop by hiding operator declarations. Addresses warnings like this that are emitted during the Swift compiler build: ``` include/llvm/Transforms/Scalar/GVN.h:268:12: warning: cycle detected while resolving 'leader_iterator' in swift_name attribute for 'operator==' [#ClangDeclarationImport] ``` --- llvm/include/llvm/MC/MCRegisterInfo.h | 2 ++ llvm/include/llvm/TextAPI/Record.h | 2 ++ llvm/include/llvm/Transforms/Scalar/GVN.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h index 11205a5a44c86..68ce575a36cbf 100644 --- a/llvm/include/llvm/MC/MCRegisterInfo.h +++ b/llvm/include/llvm/MC/MCRegisterInfo.h @@ -227,9 +227,11 @@ class MCRegisterInfo { return *this; } +#ifndef __swift__ bool operator==(const DiffListIterator &Other) const { return List == Other.List; } +#endif }; public: diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h index 7d721988ec3da..07498208402f0 100644 --- a/llvm/include/llvm/TextAPI/Record.h +++ b/llvm/include/llvm/TextAPI/Record.h @@ -219,11 +219,13 @@ class ObjCInterfaceRecord : public ObjCContainerRecord { RecordLinkage Class = RecordLinkage::Unknown; RecordLinkage MetaClass = RecordLinkage::Unknown; RecordLinkage EHType = RecordLinkage::Unknown; +#ifndef __swift__ bool operator==(const Linkages &other) const { return std::tie(Class, MetaClass, EHType) == std::tie(other.Class, other.MetaClass, other.EHType); } bool operator!=(const Linkages &other) const { return !(*this == other); } +#endif }; Linkages Linkages; diff --git a/llvm/include/llvm/Transforms/Scalar/GVN.h b/llvm/include/llvm/Transforms/Scalar/GVN.h index 61eb40aaa563c..571e1e0cea580 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVN.h +++ b/llvm/include/llvm/Transforms/Scalar/GVN.h @@ -265,12 +265,14 @@ class GVNPass : public PassInfoMixin { Current = Current->Next; return *this; } +#ifndef __swift__ bool operator==(const leader_iterator &Other) const { return Current == Other.Current; } bool operator!=(const leader_iterator &Other) const { return Current != Other.Current; } +#endif reference operator*() const { return Current->Entry; } };