Skip to content

Commit b92448d

Browse files
committed
Add operator !=
1 parent 586997d commit b92448d

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

bindgen/ir/Struct.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bool StructOrUnion::operator==(const StructOrUnion &other) const {
6262
return false;
6363
}
6464
for (size_t i = 0; i < fields.size(); i++) {
65-
if (!(*fields[i] == *s->fields[i])) {
65+
if (*fields[i] != *s->fields[i]) {
6666
return false;
6767
}
6868
}

bindgen/ir/TypeAndName.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ void TypeAndName::setType(std::shared_ptr<Type> type) { this->type = type; }
1313
bool TypeAndName::operator==(const TypeAndName &other) const {
1414
return name == other.name && *type == *other.type;
1515
}
16+
17+
bool TypeAndName::operator!=(const TypeAndName &other) const {
18+
return !(*this == other);
19+
}

bindgen/ir/TypeAndName.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class TypeAndName {
2121

2222
bool operator==(const TypeAndName &other) const;
2323

24+
bool operator!=(const TypeAndName &other) const;
25+
2426
protected:
2527
std::string name;
2628
std::shared_ptr<Type> type;

bindgen/ir/types/FunctionPointerType.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ bool FunctionPointerType::operator==(const Type &other) const {
4646
if (isVariadic != functionPointerType->isVariadic) {
4747
return false;
4848
}
49-
if (!(*returnType == *functionPointerType->returnType)) {
49+
if (*returnType != *functionPointerType->returnType) {
5050
return false;
5151
}
5252
if (parametersTypes.size() !=
5353
functionPointerType->parametersTypes.size()) {
5454
return false;
5555
}
5656
for (size_t i = 0; i < parametersTypes.size(); i++) {
57-
if (!(*parametersTypes[i] ==
58-
*functionPointerType->parametersTypes[i])) {
57+
if (*parametersTypes[i] !=
58+
*functionPointerType->parametersTypes[i]) {
5959
return false;
6060
}
6161
}

bindgen/ir/types/Type.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ std::string Type::str() const { return ""; }
55
bool Type::usesType(const std::shared_ptr<Type> &type) const { return false; }
66

77
bool Type::operator==(const Type &other) const { return false; }
8+
9+
bool Type::operator!=(const Type &other) const { return !(*this == other); }

bindgen/ir/types/Type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Type {
1616
virtual bool usesType(const std::shared_ptr<Type> &type) const;
1717

1818
virtual bool operator==(const Type &other) const;
19+
20+
virtual bool operator!=(const Type &other) const;
1921
};
2022

2123
#endif // SCALA_NATIVE_BINDGEN_TYPE_H

0 commit comments

Comments
 (0)