diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-13 06:37:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-13 06:37:47 +0000 |
commit | 8c9c586768a54b03a164f9145f0cdc382f15ec99 (patch) | |
tree | 8d15298e4829ed32a0309cbc017733bfda68216b | |
parent | b4d22f9952e05c273a27dd4f0eb2631ad3687742 (diff) | |
download | external_llvm-8c9c586768a54b03a164f9145f0cdc382f15ec99.tar.gz external_llvm-8c9c586768a54b03a164f9145f0cdc382f15ec99.tar.bz2 external_llvm-8c9c586768a54b03a164f9145f0cdc382f15ec99.zip |
Add operator< to ValID's so that they can be put in map's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@757 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/ParserInternals.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index b00a35281f..6abe6083f0 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -130,6 +130,20 @@ struct ValID { abort(); } } + + bool operator<(const ValID &V) const { + if (Type != V.Type) return Type < V.Type; + switch (Type) { + case NumberVal: return Num < V.Num; + case ConstStringVal: + case NameVal: 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 ConstNullVal: return false; + default: assert(0 && "Unknown value type!"); return false; + } + } }; |