[cfe-commits] [PATCH] Delayed template instantiation for late-parsed attributes

Delesley Hutchins delesley at google.com
Tue Dec 20 11:55:24 PST 2011


This patch delays the template instantiation of late-parsed
attributes, so that such attributes can be used in template code the
same way they are used in normal code.  Late parsed attributes may
refer to declarations later in the class, e.g.

class Foo {
  int a __attribute__((guarded_by(mu)));
  Mutex mu;
};

If Foo is templatized, then instantiation of the guarded_by attribute
must be delayed in the same way that parsing is delayed.  During class
instantiation, we store each delayed attribute in a list, along with a
clone of the local instantiation scope, and then instantiate and
attach the attributes at the end of class instantiation.

This patch is built on my previous patch for template instantiation of
attributes.

  -DeLesley

-- 
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-template-delayed-attribute.patch
Type: application/octet-stream
Size: 13939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111220/252e9e61/attachment.obj>


More information about the cfe-commits mailing list