[llvm-commits] CVS: llvm-java/include/llvm/Java/ClassFile.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Jul 8 19:01:06 PDT 2004


Changes in directory llvm-java/include/llvm/Java:

ClassFile.h updated: 1.13 -> 1.14

---
Log message:

Add map from name+descriptor to method for easy method lookup.


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

Index: llvm-java/include/llvm/Java/ClassFile.h
diff -u llvm-java/include/llvm/Java/ClassFile.h:1.13 llvm-java/include/llvm/Java/ClassFile.h:1.14
--- llvm-java/include/llvm/Java/ClassFile.h:1.13	Tue Jul  6 08:31:35 2004
+++ llvm-java/include/llvm/Java/ClassFile.h	Thu Jul  8 19:00:26 2004
@@ -16,6 +16,7 @@
 #define LLVM_JAVA_CLASSFILE_H
 
 #include <iosfwd>
+#include <map>
 #include <stdexcept>
 #include <vector>
 
@@ -65,6 +66,8 @@
         static std::vector<std::string> getClassPath();
         static std::string getFileForClass(const std::string& classname);
 
+        typedef std::map<std::string, Method*> Name2MethodMap;
+
     public:
         static const ClassFile* getClassFile(const std::string& classname);
 
@@ -92,6 +95,8 @@
 
         const Attributes& getAttributes() const { return attributes_; }
 
+        const Method* getMethod(const std::string& nameAndDescr) const;
+
         std::ostream& dump(std::ostream& os) const;
 
     private:
@@ -105,6 +110,7 @@
         Fields fields_;
         Methods methods_;
         Attributes attributes_;
+        Name2MethodMap n2mMap_;
 
         ClassFile(std::istream& is);
     };
@@ -453,6 +459,22 @@
         virtual const char* what() const throw() { return msg_.c_str(); }
     };
 
+    class ClassNotFoundException : public std::exception {
+        std::string msg_;
+    public:
+        explicit ClassNotFoundException(const std::string& msg) : msg_(msg) { }
+        virtual ~ClassNotFoundException() throw();
+        virtual const char* what() const throw() { return msg_.c_str(); }
+    };
+
+    class InvocationTargetException : public std::exception {
+        std::string msg_;
+    public:
+        explicit InvocationTargetException(const std::string& msg) : msg_(msg) { }
+        virtual ~InvocationTargetException() throw();
+        virtual const char* what() const throw() { return msg_.c_str(); }
+    };
+
 } } // namespace llvm::Java
 
 #endif//LLVM_JAVA_CLASSFILE_H





More information about the llvm-commits mailing list