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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Jul 24 13:33:33 PDT 2004



Changes in directory llvm-java/lib/ClassFile:

ClassFile.cpp updated: 1.17 -> 1.18

---
Log message:

Remove much of the constness in this file as most classes cannot be
modified anyway. We are just careful when we are returning containers
of pointers to these datastructures as we do not want users to modify
them.


---
Diffs of the changes:  (+9 -9)

Index: llvm-java/lib/ClassFile/ClassFile.cpp
diff -u llvm-java/lib/ClassFile/ClassFile.cpp:1.17 llvm-java/lib/ClassFile/ClassFile.cpp:1.18
--- llvm-java/lib/ClassFile/ClassFile.cpp:1.17	Wed Jul 14 04:21:53 2004
+++ llvm-java/lib/ClassFile/ClassFile.cpp	Sat Jul 24 15:33:23 2004
@@ -141,7 +141,7 @@
 
 //===----------------------------------------------------------------------===//
 // ClassFile implementation
-const ClassFile* ClassFile::readClassFile(std::istream& is)
+ClassFile* ClassFile::readClassFile(std::istream& is)
 {
     if (readU1(is) != 0xCA) throw ClassFileParseError("bad magic");
     if (readU1(is) != 0xFE) throw ClassFileParseError("bad magic");
@@ -189,9 +189,9 @@
     throw ClassNotFoundException("Class " + classname + " not found");
 }
 
-const ClassFile* ClassFile::getClassFile(const std::string& classname)
+ClassFile* ClassFile::getClassFile(const std::string& classname)
 {
-    typedef std::map<std::string, const ClassFile*> Name2ClassMap;
+    typedef std::map<std::string, ClassFile*> Name2ClassMap;
     static Name2ClassMap n2cMap_;
 
     Name2ClassMap::iterator it = n2cMap_.upper_bound(classname);
@@ -228,7 +228,7 @@
                 (*i)->getName()->str() + (*i)->getDescriptor()->str(), *i));
 }
 
-const Method* ClassFile::getMethod(const std::string& nameAndDescr) const
+Method* ClassFile::getMethod(const std::string& nameAndDescr) const
 {
     Name2MethodMap::const_iterator it = n2mMap_.find(nameAndDescr);
     return it == n2mMap_.end() ? NULL : it->second;
@@ -267,8 +267,8 @@
 
 //===----------------------------------------------------------------------===//
 // Utility functions
-const Attribute* llvm::Java::getAttribute(const Attributes& attrs,
-                                          const std::string& name)
+Attribute* llvm::Java::getAttribute(const Attributes& attrs,
+                                    const std::string& name)
 {
     for (unsigned i = 0, e = attrs.size(); i != e; ++i)
         if (attrs[i]->getName()->str() == name)
@@ -500,7 +500,7 @@
     return os;
 }
 
-const ConstantValueAttribute* Field::getConstantValueAttribute() const
+ConstantValueAttribute* Field::getConstantValueAttribute() const
 {
     if (!isStatic())
         return NULL;
@@ -548,12 +548,12 @@
     return os;
 }
 
-const CodeAttribute* Method::getCodeAttribute() const
+CodeAttribute* Method::getCodeAttribute() const
 {
     return (CodeAttribute*) getAttribute(attributes_, Attribute::CODE);
 }
 
-const ExceptionsAttribute* Method::getExceptionsAttribute() const
+ExceptionsAttribute* Method::getExceptionsAttribute() const
 {
     return (ExceptionsAttribute*) getAttribute(attributes_,
                                                Attribute::EXCEPTIONS);





More information about the llvm-commits mailing list