From af44641bb9fdee819848fb615088e4271ec1eb8b Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Fri, 7 Sep 2012 15:07:42 -0700 Subject: [PATCH] add noalias attribute to parameters --- builder.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/builder.py b/builder.py index 19822e0..a2f7aa9 100644 --- a/builder.py +++ b/builder.py @@ -765,7 +765,7 @@ class CDefinition(CBuilder): ''' _name_ = '' # name of the function; should overide in subclass _retty_ = types.void # return type; can overide in subclass - _argtys_ = [] # a list of tuple(name, type); can overide in subclass + _argtys_ = [] # a list of tuple(name, type, [attributes]); can overide in subclass def __new__(cls, *args, **kws): if cls.is_generic(): @@ -790,7 +790,7 @@ class CDefinition(CBuilder): Raises NameError if a function of the same name has already been defined. ''' - functype = lc.Type.function(cls._retty_, [v for k, v in cls._argtys_]) + functype = lc.Type.function(cls._retty_, [arg[1] for arg in cls._argtys_]) name = cls._name_ if not name: raise AttributeError("Function name cannot be empty.") @@ -801,9 +801,12 @@ class CDefinition(CBuilder): raise FunctionAlreadyExists(func) # Name all arguments - for i, (name, _) in enumerate(cls._argtys_): + for i, arginfo in enumerate(cls._argtys_): + name = arginfo[0] func.args[i].name = name - + if len(arginfo) > 2: + for attr in arginfo[2]: + func.args[i].add_attribute(attr) # Create builder and populate body cbuilder = object.__new__(cls) cbuilder.__init__(func)