Revision: 1143
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1143&view=rev
Author: roman_yakovenko
Date: 2007-11-12 12:19:25 -0800 (Mon, 12 Nov 2007)
Log Message:
-----------
adding restricted type
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/__init__.py
pygccxml_dev/pygccxml/declarations/cpptypes.py
pygccxml_dev/pygccxml/declarations/type_visitor.py
Modified: pygccxml_dev/pygccxml/declarations/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-12 19:11:14 UTC (rev 1142)
+++ pygccxml_dev/pygccxml/declarations/__init__.py 2007-11-12 20:19:25 UTC (rev 1143)
@@ -49,6 +49,7 @@
from cpptypes import const_t
from cpptypes import pointer_t
from cpptypes import reference_t
+from cpptypes import restrict_t
from cpptypes import array_t
from cpptypes import calldef_type_t
from cpptypes import free_function_type_t
Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/cpptypes.py 2007-11-12 19:11:14 UTC (rev 1142)
+++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2007-11-12 20:19:25 UTC (rev 1143)
@@ -342,6 +342,27 @@
def _clone_impl( self ):
return volatile_t( self.base.clone() )
+class restrict_t( compound_t ):
+ """represents C{restrict whatever} type"""
+
+ #The restrict keyword can be considered an extension to the strict aliasing
+ #rule. It allows the programmer to declare that pointers which share the same
+ #type (or were otherwise validly created) do not alias eachother. By using
+ #restrict the programmer can declare that any loads and stores through the
+ #qualified pointer (or through another pointer copied either directly or
+ #indirectly from the restricted pointer) are the only loads and stores to
+ #the same address during the lifetime of the pointer. In other words, the
+ #pointer is not aliased by any pointers other than its own copies.
+
+ def __init__( self, base ):
+ compound_t.__init__( self, base)
+
+ def _create_decl_string(self):
+ return '__restrict__ ' + self.base.decl_string
+
+ def _clone_impl( self ):
+ return restrict_t( self.base.clone() )
+
class const_t( compound_t ):
"""represents C{whatever const} type"""
def __init__( self, base ):
Modified: pygccxml_dev/pygccxml/declarations/type_visitor.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/type_visitor.py 2007-11-12 19:11:14 UTC (rev 1142)
+++ pygccxml_dev/pygccxml/declarations/type_visitor.py 2007-11-12 20:19:25 UTC (rev 1143)
@@ -125,4 +125,8 @@
raise NotImplementedError()
def visit_declarated( self ):
- raise NotImplementedError()
\ No newline at end of file
+ raise NotImplementedError()
+
+ def visit_restrict( self ):
+ raise NotImplementedError()
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|