diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-19 18:34:28 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-19 18:34:28 +0000 |
commit | 49bd921f087332882acd04659344822cda673a2b (patch) | |
tree | 84049c5c75c24fad570097e9d1c2ee46c5962399 /llvm/lib/AsmParser/ParserInternals.h | |
parent | 508167861d7120fc7a73e0652f237abf6aaac439 (diff) | |
download | bcm5719-llvm-49bd921f087332882acd04659344822cda673a2b.tar.gz bcm5719-llvm-49bd921f087332882acd04659344822cda673a2b.zip |
Add and Operator== method to ValID so equality can be done properly for
named or numbered ValIDs.
llvm-svn: 35172
Diffstat (limited to 'llvm/lib/AsmParser/ParserInternals.h')
-rw-r--r-- | llvm/lib/AsmParser/ParserInternals.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h index 1bc744bc4bb..6396d94d258 100644 --- a/llvm/lib/AsmParser/ParserInternals.h +++ b/llvm/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 { |