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

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



Changes in directory llvm-java/lib/ClassFile:

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

Add convinience member function to easily get ConstantClass objects
from the constant pool.


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

Index: llvm-java/lib/ClassFile/ClassFile.cpp
diff -u llvm-java/lib/ClassFile/ClassFile.cpp:1.22 llvm-java/lib/ClassFile/ClassFile.cpp:1.23
--- llvm-java/lib/ClassFile/ClassFile.cpp:1.22	Fri Aug  6 06:04:28 2004
+++ llvm-java/lib/ClassFile/ClassFile.cpp	Fri Aug  6 06:24:52 2004
@@ -244,11 +244,11 @@
         (*i)->getName()->str() + (*i)->getDescriptor()->str(), *i));
 }
 
-ConstantMethodRef* ClassFile::getConstantMethodRef(unsigned index) const
+ConstantClass* ClassFile::getConstantClass(unsigned index) const
 {
-  assert(dynamic_cast<ConstantMethodRef*>(getConstant(index)) &&
-         "Constant is not a ConstantMethodRef!");
-  return static_cast<ConstantMethodRef*>(getConstant(index));
+  assert(dynamic_cast<ConstantClass*>(getConstant(index)) &&
+         "Constant is not a ConstantClass!");
+  return static_cast<ConstantClass*>(getConstant(index));
 }
 
 ConstantFieldRef* ClassFile::getConstantFieldRef(unsigned index) const
@@ -258,6 +258,13 @@
   return static_cast<ConstantFieldRef*>(getConstant(index));
 }
 
+ConstantMethodRef* ClassFile::getConstantMethodRef(unsigned index) const
+{
+  assert(dynamic_cast<ConstantMethodRef*>(getConstant(index)) &&
+         "Constant is not a ConstantMethodRef!");
+  return static_cast<ConstantMethodRef*>(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