[cfe-commits] [PATCH] Thread-safety analysis: properly handle attributes on functions with separate definitions.

Delesley Hutchins delesley at google.com
Thu Jan 5 13:38:38 PST 2012


This patch fixes thread safety attributes so that attributes which are
applied to a function declaration will be properly rewritten when
transferred to the definition.  E.g.

class Foo {
  void foo(MyObj *o) EXCLUSIVE_LOCKS_REQUIRED(o->mu_);
}

// o->mu_ must be rewritten to obj->mu_ in this scope.
Foo::foo(MyObj *obj)  { ... }

We do this by storing the original Decl that the attribute was
attached to.  When examining the attribute later, if the original Decl
does not match the current Decl, it is rewritten to the current Decl.

Patch is enclosed, and can be viewed at:

  http://codereview.appspot.com/5520050/

-- 
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-function-decldef.patch
Type: application/octet-stream
Size: 17342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120105/91aa836a/attachment.obj>


More information about the cfe-commits mailing list