[llvm-commits] CVS: llvm/lib/AsmParser/ParserInternals.h

Reid Spencer reid at x10sys.com
Mon Mar 19 11:34:46 PDT 2007



Changes in directory llvm/lib/AsmParser:

ParserInternals.h updated: 1.53 -> 1.54
---
Log message:

Add and Operator== method to ValID so equality can be done properly for
named or numbered ValIDs.


---
Diffs of the changes:  (+20 -0)

 ParserInternals.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)


Index: llvm/lib/AsmParser/ParserInternals.h
diff -u llvm/lib/AsmParser/ParserInternals.h:1.53 llvm/lib/AsmParser/ParserInternals.h:1.54
--- llvm/lib/AsmParser/ParserInternals.h:1.53	Fri Jan 26 02:04:51 2007
+++ llvm/lib/AsmParser/ParserInternals.h	Mon Mar 19 13:34:28 2007
@@ -207,6 +207,26 @@
     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 {






More information about the llvm-commits mailing list