1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add and Operator== method to ValID so equality can be done properly for

named or numbered ValIDs.

llvm-svn: 35172
This commit is contained in:
Reid Spencer 2007-03-19 18:34:28 +00:00
parent 135ca5e8c4
commit 34f69893be

View File

@ -207,6 +207,26 @@ struct ValID {
default: assert(0 && "Unknown value type!"); return false;
}
}
bool operator==(const ValID &V) const {
if (Type == V.Type) {
switch (Type) {
case LocalID:
case GlobalID: return Num == V.Num;
case LocalName:
case GlobalName: return strcmp(Name, V.Name) == 0;
case ConstSIntVal: return ConstPool64 == V.ConstPool64;
case ConstUIntVal: return UConstPool64 == V.UConstPool64;
case ConstFPVal: return ConstPoolFP == V.ConstPoolFP;
case ConstantVal: return ConstantValue == V.ConstantValue;
case ConstNullVal: return true;
case ConstUndefVal: return true;
case ConstZeroVal: return true;
default: assert(0 && "Unknown value type!"); return false;
}
}
return false;
}
};
struct TypeWithAttrs {