[llvm-commits] CVS: llvm-java/lib/ClassFile/ClassFile.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Aug 22 16:06:29 PDT 2004



Changes in directory llvm-java/lib/ClassFile:

ClassFile.cpp updated: 1.23 -> 1.24
---
Log message:

Add parent ConstantClass objects to Fields and Methods, referring to
the owning class of the corresponding field or method.


---
Diffs of the changes:  (+16 -8)

Index: llvm-java/lib/ClassFile/ClassFile.cpp
diff -u llvm-java/lib/ClassFile/ClassFile.cpp:1.23 llvm-java/lib/ClassFile/ClassFile.cpp:1.24
--- llvm-java/lib/ClassFile/ClassFile.cpp:1.23	Fri Aug  6 06:24:52 2004
+++ llvm-java/lib/ClassFile/ClassFile.cpp	Sun Aug 22 18:06:18 2004
@@ -110,22 +110,28 @@
     }
   }
 
-  void readFields(Fields& f, const ConstantPool& cp, std::istream& is)
+  void readFields(Fields& f,
+                  ConstantClass* parent,
+                  const ConstantPool& cp,
+                  std::istream& is)
   {
     assert(f.empty() && "Should not call with a non-empty fields vector");
     uint16_t count = readU2(is);
     f.reserve(count);
     while(count--)
-      f.push_back(Field::readField(cp, is));
+      f.push_back(Field::readField(parent, cp, is));
   }
 
-  void readMethods(Methods& m, const ConstantPool& cp, std::istream& is)
+  void readMethods(Methods& m,
+                   ConstantClass* parent,
+                   const ConstantPool& cp,
+                   std::istream& is)
   {
     assert(m.empty() && "Should not call with a non-empty methods vector");
     uint16_t count = readU2(is);
     m.reserve(count);
     while(count--)
-      m.push_back(Method::readMethod(cp, is));
+      m.push_back(Method::readMethod(parent, cp, is));
   }
 
   void readAttributes(Attributes& a,
@@ -234,8 +240,8 @@
     throw ClassFileSemanticError(
       "Representation of super class is not of type ConstantClass");
   readClasses(interfaces_, cPool_, is);
-  readFields(fields_, cPool_, is);
-  readMethods(methods_, cPool_, is);
+  readFields(fields_, thisClass_, cPool_, is);
+  readMethods(methods_, thisClass_, cPool_, is);
   readAttributes(attributes_, cPool_, is);
   for (Methods::const_iterator
          i = methods_.begin(), e = methods_.end(); i != e; ++i)
@@ -501,7 +507,8 @@
 
 //===----------------------------------------------------------------------===//
 // Field implementation
-Field::Field(const ConstantPool& cp, std::istream& is)
+Field::Field(ConstantClass* parent, const ConstantPool& cp, std::istream& is)
+  : parent_(parent)
 {
   accessFlags_ = readU2(is);
   name_ = dynamic_cast<ConstantUtf8*>(cp[readU2(is)]);
@@ -548,7 +555,8 @@
 
 //===----------------------------------------------------------------------===//
 // Method implementation
-Method::Method(const ConstantPool& cp, std::istream& is)
+Method::Method(ConstantClass* parent, const ConstantPool& cp, std::istream& is)
+  : parent_(parent)
 {
   accessFlags_ = readU2(is);
   name_ = dynamic_cast<ConstantUtf8*>(cp[readU2(is)]);






More information about the llvm-commits mailing list