[llvm-commits] CVS: llvm/tools/llvm-upgrade/ParserInternals.h

Reid Spencer reid at x10sys.com
Wed Jan 3 15:45:33 PST 2007



Changes in directory llvm/tools/llvm-upgrade:

ParserInternals.h updated: 1.11 -> 1.12
---
Log message:

Implement many new type features including upreferences, proper retention
of structure contents, counts of packed and array types, etc.


---
Diffs of the changes:  (+15 -4)

 ParserInternals.h |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)


Index: llvm/tools/llvm-upgrade/ParserInternals.h
diff -u llvm/tools/llvm-upgrade/ParserInternals.h:1.11 llvm/tools/llvm-upgrade/ParserInternals.h:1.12
--- llvm/tools/llvm-upgrade/ParserInternals.h:1.11	Mon Jan  1 23:44:33 2007
+++ llvm/tools/llvm-upgrade/ParserInternals.h	Wed Jan  3 17:45:17 2007
@@ -50,7 +50,7 @@
 enum Types {
   BoolTy, SByteTy, UByteTy, ShortTy, UShortTy, IntTy, UIntTy, LongTy, ULongTy,
   FloatTy, DoubleTy, PointerTy, PackedTy, ArrayTy, StructTy, PackedStructTy, 
-  OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, NumericTy
+  OpaqueTy, VoidTy, LabelTy, FunctionTy, UnresolvedTy, UpRefTy
 };
 
 /// This type is used to keep track of the signedness of values. Instead
@@ -152,7 +152,7 @@
   }
 
   bool isUnresolved() const { return oldTy == UnresolvedTy; }
-  bool isNumeric() const { return oldTy == NumericTy; }
+  bool isUpReference() const { return oldTy == UpRefTy; }
   bool isVoid() const { return oldTy == VoidTy; }
   bool isBool() const { return oldTy == BoolTy; }
   bool isSigned() const {
@@ -233,6 +233,17 @@
     return 0;
   }
 
+  unsigned getNumStructElements() const { 
+    return (elements ? elements->size() : 0);
+  }
+
+  TypeInfo* getElement(unsigned idx) {
+    if (elements)
+      if (idx < elements->size())
+        return (*elements)[idx];
+    return 0;
+  }
+
 private:
   std::string* newTy;
   Types oldTy;
@@ -246,11 +257,11 @@
 struct ConstInfo {
   std::string *cnst;
   TypeInfo *type;
-  void destroy() { delete cnst; delete type; }
+  void destroy() { delete cnst; }
 };
 
 typedef std::vector<ValueInfo> ValueList;
 
-inline void ValueInfo::destroy() { delete val; delete type; }
+inline void ValueInfo::destroy() { delete val; }
 
 #endif






More information about the llvm-commits mailing list