Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/include/llvm/Support/JSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class Object {
LLVM_ABI json::Object *getObject(StringRef K);
LLVM_ABI const json::Array *getArray(StringRef K) const;
LLVM_ABI json::Array *getArray(StringRef K);

friend bool operator==(const Object &LHS, const Object &RHS);
};
LLVM_ABI bool operator==(const Object &LHS, const Object &RHS);
inline bool operator!=(const Object &LHS, const Object &RHS) {
Expand Down
11 changes: 1 addition & 10 deletions llvm/lib/Support/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,7 @@ json::Array *Object::getArray(StringRef K) {
return V->getAsArray();
return nullptr;
}
bool operator==(const Object &LHS, const Object &RHS) {
if (LHS.size() != RHS.size())
return false;
for (const auto &L : LHS) {
auto R = RHS.find(L.first);
if (R == RHS.end() || L.second != R->second)
return false;
}
return true;
}
bool operator==(const Object &LHS, const Object &RHS) { return LHS.M == RHS.M; }

Array::Array(std::initializer_list<Value> Elements) {
V.reserve(Elements.size());
Expand Down