Skip to content

Commit 8df86e6

Browse files
committed
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.
1 parent bd75441 commit 8df86e6

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

llvm/include/llvm/Support/Registry.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ namespace llvm {
100100
public:
101101
explicit iterator(const node *N) : Cur(N) {}
102102

103+
#ifndef __swift__
103104
bool operator==(const iterator &That) const { return Cur == That.Cur; }
105+
#endif
104106
iterator &operator++() { Cur = Cur->Next; return *this; }
105107
const entry &operator*() const { return Cur->Val; }
106108
};

llvm/include/llvm/TextAPI/Record.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,13 @@ class ObjCInterfaceRecord : public ObjCContainerRecord {
221221
RecordLinkage Class = RecordLinkage::Unknown;
222222
RecordLinkage MetaClass = RecordLinkage::Unknown;
223223
RecordLinkage EHType = RecordLinkage::Unknown;
224+
#ifndef __swift__
224225
bool operator==(const Linkages &other) const {
225226
return std::tie(Class, MetaClass, EHType) ==
226227
std::tie(other.Class, other.MetaClass, other.EHType);
227228
}
228229
bool operator!=(const Linkages &other) const { return !(*this == other); }
230+
#endif
229231
};
230232
Linkages Linkages;
231233

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,11 +5852,13 @@ struct AAPointerInfo : public AbstractAttribute {
58525852
const_iterator begin() const { return Offsets.begin(); }
58535853
const_iterator end() const { return Offsets.end(); }
58545854

5855+
#ifndef __swift__
58555856
bool operator==(const OffsetInfo &RHS) const {
58565857
return Offsets == RHS.Offsets;
58575858
}
58585859

58595860
bool operator!=(const OffsetInfo &RHS) const { return !(*this == RHS); }
5861+
#endif
58605862

58615863
bool insert(int64_t Offset) { return Offsets.insert(Offset).second; }
58625864
bool isUnassigned() const { return Offsets.size() == 0; }

llvm/include/llvm/Transforms/Scalar/GVN.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,14 @@ class GVNPass : public PassInfoMixin<GVNPass> {
292292
Current = Current->Next;
293293
return *this;
294294
}
295+
#ifndef __swift__
295296
bool operator==(const leader_iterator &Other) const {
296297
return Current == Other.Current;
297298
}
298299
bool operator!=(const leader_iterator &Other) const {
299300
return Current != Other.Current;
300301
}
302+
#endif
301303
reference operator*() const { return Current->Entry; }
302304
};
303305

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,13 @@ class SeedContainer {
260260
++(*this);
261261
return Copy;
262262
}
263+
#ifndef __swift__
263264
bool operator==(const iterator &Other) const {
264265
assert(Map == Other.Map && "Iterator of different objects!");
265266
return MapIt == Other.MapIt && VecIdx == Other.VecIdx;
266267
}
267268
bool operator!=(const iterator &Other) const { return !(*this == Other); }
269+
#endif
268270
};
269271
using const_iterator = BundleMapT::const_iterator;
270272
template <typename LoadOrStoreT> void insert(LoadOrStoreT *LSI);

0 commit comments

Comments
 (0)