aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-19 18:34:28 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-19 18:34:28 +0000
commit4e0422c7e67574a440cc68484267e4dc50a62a3d (patch)
tree5076c43004c193f820fb3413092095a26464c68d
parent590b3c559fd7ca42e3d8c21e834481b0ff12c1a1 (diff)
Add and Operator== method to ValID so equality can be done properly for
named or numbered ValIDs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35172 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/ParserInternals.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index 1bc744bc4b..6396d94d25 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -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 {