From 8df86e69730fdc6063ca3a74e27215eebf4c11df Mon Sep 17 00:00:00 2001 From: Allan Shortlidge Date: Sun, 26 Oct 2025 11:56:57 -0700 Subject: [PATCH] Suppress warnings for Swift C++ interop by hiding an operator declaration Works around a Swift compiler bug that generates a lot of spurious warnings while building the Swift compiler. --- llvm/include/llvm/Support/Registry.h | 2 ++ llvm/include/llvm/TextAPI/Record.h | 2 ++ llvm/include/llvm/Transforms/IPO/Attributor.h | 2 ++ llvm/include/llvm/Transforms/Scalar/GVN.h | 2 ++ .../llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h | 2 ++ 5 files changed, 10 insertions(+) diff --git a/llvm/include/llvm/Support/Registry.h b/llvm/include/llvm/Support/Registry.h index ff9226c39359c..79f6140297f34 100644 --- a/llvm/include/llvm/Support/Registry.h +++ b/llvm/include/llvm/Support/Registry.h @@ -100,7 +100,9 @@ namespace llvm { public: explicit iterator(const node *N) : Cur(N) {} +#ifndef __swift__ bool operator==(const iterator &That) const { return Cur == That.Cur; } +#endif iterator &operator++() { Cur = Cur->Next; return *this; } const entry &operator*() const { return Cur->Val; } }; diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h index 6e470d97325fd..6c07ab392458c 100644 --- a/llvm/include/llvm/TextAPI/Record.h +++ b/llvm/include/llvm/TextAPI/Record.h @@ -221,11 +221,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/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 904f58b055b7b..d66a3f3be5e25 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -5852,11 +5852,13 @@ struct AAPointerInfo : public AbstractAttribute { const_iterator begin() const { return Offsets.begin(); } const_iterator end() const { return Offsets.end(); } +#ifndef __swift__ bool operator==(const OffsetInfo &RHS) const { return Offsets == RHS.Offsets; } bool operator!=(const OffsetInfo &RHS) const { return !(*this == RHS); } +#endif bool insert(int64_t Offset) { return Offsets.insert(Offset).second; } bool isUnassigned() const { return Offsets.size() == 0; } diff --git a/llvm/include/llvm/Transforms/Scalar/GVN.h b/llvm/include/llvm/Transforms/Scalar/GVN.h index 77a14076ca256..87153c2d64a64 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVN.h +++ b/llvm/include/llvm/Transforms/Scalar/GVN.h @@ -292,12 +292,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; } }; diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h index ec70350691abe..22b597429287d 100644 --- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h +++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h @@ -260,11 +260,13 @@ class SeedContainer { ++(*this); return Copy; } +#ifndef __swift__ bool operator==(const iterator &Other) const { assert(Map == Other.Map && "Iterator of different objects!"); return MapIt == Other.MapIt && VecIdx == Other.VecIdx; } bool operator!=(const iterator &Other) const { return !(*this == Other); } +#endif }; using const_iterator = BundleMapT::const_iterator; template void insert(LoadOrStoreT *LSI);