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

Alkis Evlogimenos alkis at cs.uiuc.edu
Fri Aug 6 04:04:39 PDT 2004



Changes in directory llvm-java/lib/ClassFile:

ClassFile.cpp updated: 1.21 -> 1.22
---
Log message:

Add convinience methods for accessing Constants from the constant pool.


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

Index: llvm-java/lib/ClassFile/ClassFile.cpp
diff -u llvm-java/lib/ClassFile/ClassFile.cpp:1.21 llvm-java/lib/ClassFile/ClassFile.cpp:1.22
--- llvm-java/lib/ClassFile/ClassFile.cpp:1.21	Wed Aug  4 05:02:03 2004
+++ llvm-java/lib/ClassFile/ClassFile.cpp	Fri Aug  6 06:04:28 2004
@@ -244,6 +244,20 @@
         (*i)->getName()->str() + (*i)->getDescriptor()->str(), *i));
 }
 
+ConstantMethodRef* ClassFile::getConstantMethodRef(unsigned index) const
+{
+  assert(dynamic_cast<ConstantMethodRef*>(getConstant(index)) &&
+         "Constant is not a ConstantMethodRef!");
+  return static_cast<ConstantMethodRef*>(getConstant(index));
+}
+
+ConstantFieldRef* ClassFile::getConstantFieldRef(unsigned index) const
+{
+  assert(dynamic_cast<ConstantFieldRef*>(getConstant(index)) &&
+         "Constant is not a ConstantFieldRef!");
+  return static_cast<ConstantFieldRef*>(getConstant(index));
+}
+
 Method* ClassFile::getMethod(const std::string& nameAndDescr) const
 {
   Name2MethodMap::const_iterator it = n2mMap_.find(nameAndDescr);






More information about the llvm-commits mailing list