[pygccxml-commit] SF.net SVN: pygccxml:[1852] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2011-02-26 20:08:38
|
Revision: 1852
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1852&view=rev
Author: roman_yakovenko
Date: 2011-02-26 20:08:30 +0000 (Sat, 26 Feb 2011)
Log Message:
-----------
"has_inline" property was added to ``declarations.calldef_t`` class.
Modified Paths:
--------------
pygccxml_dev/docs/history/history.rest
pygccxml_dev/pygccxml/declarations/calldef.py
pygccxml_dev/pygccxml/parser/scanner.py
pygccxml_dev/unittests/test_all.py
Added Paths:
-----------
pygccxml_dev/unittests/data/inline_specifier.hpp
pygccxml_dev/unittests/inline_specifier_tester.py
Modified: pygccxml_dev/docs/history/history.rest
===================================================================
--- pygccxml_dev/docs/history/history.rest 2011-02-26 19:32:41 UTC (rev 1851)
+++ pygccxml_dev/docs/history/history.rest 2011-02-26 20:08:30 UTC (rev 1852)
@@ -65,7 +65,9 @@
for providing the patch.
12. Thanks to Aron Xu, for pointing out that it is better to use "os.name",
- instead of "sys.platform" for platform specific logic
+ instead of "sys.platform" for platform specific logic.
+
+13. "has_inline" property was added to ``declarations.calldef_t`` class.
-----------
Modified: pygccxml_dev/pygccxml/declarations/calldef.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/calldef.py 2011-02-26 19:32:41 UTC (rev 1851)
+++ pygccxml_dev/pygccxml/declarations/calldef.py 2011-02-26 20:08:30 UTC (rev 1852)
@@ -166,6 +166,7 @@
self._has_extern = has_extern
self._demangled_name = None
self._calling_convention = None
+ self._has_inline = None
def _get__cmp__call_items(self):
"""implementation details"""
@@ -178,7 +179,8 @@
, self.has_extern
, self.does_throw
, self._sorted_list( self.exceptions )
- , self.demangled_name ]
+ , self.demangled_name
+ , self.has_inline ]
items.extend( self._get__cmp__call_items() )
return items
@@ -274,6 +276,15 @@
@type: bool
""")
+ def _get_has_inline(self):
+ return self._has_inline
+ def _set_has_inline(self, has_inline):
+ self._has_inline = has_inline
+ has_inline = property( _get_has_inline, _set_has_inline,
+ doc="""Was this callable declared with "inline" specifier
+ @type: bool
+ """)
+
def __remove_parent_fname( self, demangled ):
"""implementation details"""
demangled = demangled.strip()
Modified: pygccxml_dev/pygccxml/parser/scanner.py
===================================================================
--- pygccxml_dev/pygccxml/parser/scanner.py 2011-02-26 19:32:41 UTC (rev 1851)
+++ pygccxml_dev/pygccxml/parser/scanner.py 2011-02-26 20:08:30 UTC (rev 1852)
@@ -35,6 +35,7 @@
XML_AN_ID = "id"
XML_AN_INCOMPLETE = "incomplete"
XML_AN_INIT = "init"
+XML_AN_INLINE = "inline"
XML_AN_LINE = "line"
XML_AN_MANGLED = "mangled"
XML_AN_MAX = "max"
@@ -406,6 +407,7 @@
self.__calldefs.append( calldef )
calldef.name = attrs.get(XML_AN_NAME, '')
calldef.has_extern = attrs.get( XML_AN_EXTERN, False )
+ calldef.has_inline = bool( attrs.get( XML_AN_INLINE, "" ) == "1" )
throw_stmt = attrs.get( XML_AN_THROW, None )
if None is throw_stmt:
calldef.does_throw = True
Added: pygccxml_dev/unittests/data/inline_specifier.hpp
===================================================================
--- pygccxml_dev/unittests/data/inline_specifier.hpp (rev 0)
+++ pygccxml_dev/unittests/data/inline_specifier.hpp 2011-02-26 20:08:30 UTC (rev 1852)
@@ -0,0 +1,8 @@
+struct text_t{
+ inline bool inlined() const { return true; }
+ unsigned long not_inlined() const;
+};
+
+
+inline bool inlined(text_t){ return true; }
+unsigned long not_inlined(text_t);
Added: pygccxml_dev/unittests/inline_specifier_tester.py
===================================================================
--- pygccxml_dev/unittests/inline_specifier_tester.py (rev 0)
+++ pygccxml_dev/unittests/inline_specifier_tester.py 2011-02-26 20:08:30 UTC (rev 1852)
@@ -0,0 +1,52 @@
+# Copyright 2004-2008 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import unittest
+import autoconfig
+import parser_test_case
+
+from pygccxml import utils
+from pygccxml import parser
+from pygccxml import declarations
+
+class tester_t( parser_test_case.parser_test_case_t ):
+
+ global_ns = None
+
+ def __init__(self, *args ):
+ parser_test_case.parser_test_case_t.__init__( self, *args )
+ self.header = 'inline_specifier.hpp'
+
+ def setUp(self):
+ if not tester_t.global_ns:
+ decls = parser.parse( [self.header], self.config )
+ tester_t.global_ns = declarations.get_global_namespace( decls )
+ tester_t.global_ns.init_optimizer()
+
+ def test( self ):
+ inlined_funcs = self.global_ns.calldefs( 'inlined' )
+ self.failUnless( len(inlined_funcs) )
+ for f in inlined_funcs:
+ self.failUnless( f.has_inline == True )
+
+ not_inlined_funcs = self.global_ns.calldefs( 'not_inlined' )
+ self.failUnless( len(not_inlined_funcs) )
+ for f in not_inlined_funcs:
+ self.failUnless( f.has_inline == False )
+
+
+ def test2( self ):
+ pass
+
+def create_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite(tester_t))
+ return suite
+
+def run_suite():
+ unittest.TextTestRunner(verbosity=2).run( create_suite() )
+
+if __name__ == "__main__":
+ run_suite()
Modified: pygccxml_dev/unittests/test_all.py
===================================================================
--- pygccxml_dev/unittests/test_all.py 2011-02-26 19:32:41 UTC (rev 1851)
+++ pygccxml_dev/unittests/test_all.py 2011-02-26 20:08:30 UTC (rev 1852)
@@ -58,6 +58,7 @@
import gccxml10183_tester
import gccxml10184_tester
import gccxml10185_tester
+import inline_specifier_tester
testers = [
decl_string_tester
@@ -112,6 +113,7 @@
, gccxml10183_tester
, gccxml10184_tester
, gccxml10185_tester
+ , inline_specifier_tester
]
def create_suite():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|