[pypy-commit] pypy reflex-support: make STL-life easier

wlav noreply at buildbot.pypy.org
Thu Jul 26 01:25:46 CEST 2012


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r56452:6b1de0070af5
Date: 2012-07-25 16:25 -0700
http://bitbucket.org/pypy/pypy/changeset/6b1de0070af5/

Log:	make STL-life easier

diff --git a/pypy/module/cppyy/src/reflexcwrapper.cxx b/pypy/module/cppyy/src/reflexcwrapper.cxx
--- a/pypy/module/cppyy/src/reflexcwrapper.cxx
+++ b/pypy/module/cppyy/src/reflexcwrapper.cxx
@@ -282,6 +282,13 @@
 
 int cppyy_num_bases(cppyy_type_t handle) {
     Reflex::Type t = type_from_handle(handle);
+    std::string name = t.Name(Reflex::FINAL|Reflex::SCOPED);
+    if (5 < name.size() && name.substr(0, 5) == "std::") {
+        // special case: STL base classes are usually unnecessary,
+        // so either build all (i.e. if available) or none
+        for (int i=0; i < (int)t.BaseSize(); ++i)
+            if (!t.BaseAt(i)) return 0;
+    }
     return t.BaseSize();
 }
 
diff --git a/pypy/module/cppyy/test/stltypes.xml b/pypy/module/cppyy/test/stltypes.xml
--- a/pypy/module/cppyy/test/stltypes.xml
+++ b/pypy/module/cppyy/test/stltypes.xml
@@ -3,18 +3,17 @@
   <namespace name="std" />
 
   <class pattern="std::vector<*>" />
-  <class pattern="std::_Vector_base<*>" />
-  <class pattern="std::_Vector_base<*>::_Vector_impl" />
   <class pattern="std::vector<*>::iterator" />
   <class pattern="std::vector<*>::const_iterator" />
 
   <class pattern="std::list<*>" />
-  <class pattern="std::_List_base<*>" />
   <class pattern="std::list<*>::iterator" />
   <class pattern="std::list<*>::const_iterator" />
   <class name="std::__detail::_List_node_base" />
 
   <class pattern="__gnu_cxx::__normal_iterator<*>" />
+
+  <!-- the following are for testing, not for iteration -->
   <function name="__gnu_cxx::operator=="/>
   <function name="__gnu_cxx::operator!="/>
 


More information about the pypy-commit mailing list