[cfe-commits] [PATCH] Delayed parsing for GNU attributes

Caitlin Sadowski supertri at google.com
Wed Sep 7 10:31:09 PDT 2011


Note that the small function parameter parsing fix (previously sent
out by DeLesley -- message forwarded below) should be reviewed with
the delayed parsing patch. I am attaching it to this thread.

Cheers,

Caitlin


---------- Forwarded message ----------
From: Delesley Hutchins <delesley at google.com>
Date: Fri, Sep 2, 2011 at 11:42 AM
Subject: [PATCH] Extend lexical scope of attributes to include
function parameters.
To: cfe-commits at cs.uiuc.edu, Caitlin Sadowski <supertri at google.com>,
Chandler Carruth <chandlerc at google.com>, Douglas Gregor
<dgregor at apple.com>


This patch extends the lexical scope of attributes to include method
parameters.  The main motivation for this patch is to implement thread
safety attributes, such as the following:

class Foo {
 int foo(Foo *f) __attribute__((exclusive_locks_required(f->mu))) { }

 Mutex mu;
};

The change in scope is only enabled for attributes that are tagged as
being late parsed, using the previous late parsing patch; this
currently means that it is enabled only for thread-safety attributes.
It also works only on methods and not top-level functions, since
top-level functions do not currently use late parsing.

 http://codereview.appspot.com/4959055/

 -DeLesley

--
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315



On Fri, Sep 2, 2011 at 11:25 AM, Delesley Hutchins <delesley at google.com> wrote:
> Updated patch which fixes a few coding style issues.
>
> On Thu, Sep 1, 2011 at 1:40 PM, Delesley Hutchins <delesley at google.com> wrote:
>> This patch implements delayed parsing for GNU attributes.  The main
>> motivation for this patch is to implement thread safety attributes,
>> such as the following:
>>
>> class Foo {
>>  int x __attribute__((guarded_by(mu)));
>>  int foo() __attribute__((exclusive_locks_required(mu)));
>>  Mutex mu;
>> }
>>
>> Delayed parsing is now turned on for any GNU attribute that specifies
>> LateParsed=1 in Attr.td.  Note that support for delayed parsing is
>> incomplete, in that it is only enabled for attributes at the end of a
>> member declaration; this is due to a limitation in the current
>> implementation that we hope to remove at some point.
>>
>> Patches for llvm and clang are attached, and can also be found at:
>>
>>  http://codereview.appspot.com/4975048/
>>  http://codereview.appspot.com/4975049/
>>
>> Cheers,
>>
>> DeLesley Hutchins and Caitlin Sadowski
>>
>> --
>> DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
>>
>
>
>
> --
> DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: function_parameter_parsing2.patch
Type: application/octet-stream
Size: 2855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110907/55a982d9/attachment.obj>


More information about the cfe-commits mailing list