<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I’m trying to get a minimal demo prototype of P0066 (generalized lifetime extension, a.k.a. formal accessors and views). The ISO conference is next week and it would be nice to have something. This is my first serious Clang patch so I’m just getting up to speed.</div><div class=""><br class=""></div><div class="">The idea is to have per-parameter specifiers (“<font face="Courier" class="">void f(export foo *)</font>”) that apply to the function type, not the parameter type. It’s a bit tricky, but I’ve settled on a strategy like this:</div><div class=""><br class=""></div><div class="">1. Alias the specifier to the existing Objective-C lifetime qualifiers. Objective-C (indirect) lifetime types may have ObjC lifetime qualifiers; other types have C++ lifetime qualifiers. But, the C++ qualifiers only appear within parameters.</div><div class=""><br class=""></div><div class="">2. Like their Objective-C counterparts, C++ lifetime qualifiers are not part of the canonical type of a parameter variable. However, they are part of the canonical type of the function. This is accomplished by <a href="https://github.com/llvm-mirror/clang/compare/master...potswa:lifetime_extension#diff-e50bb45cfe9f513ac1cb6b2e03e92e3dR3044" class="">reintroducing</a> them into the parameters when generating each new <font face="Courier" class="">FunctionProtoType</font>.</div><div class=""><br class=""></div><div class="">Any feedback would be nice. Have I committed any mortal sins? Will non-canonical type qualifiers bite me when I least expect it? Disambiguating the aliased qualifiers takes a bit of ongoing work, but it seems worthwhile, and the alternatives seem harder and/or inefficient.</div><div class=""><br class=""></div><div class="">View the changes here: <a href="https://github.com/llvm-mirror/clang/compare/master...potswa:lifetime_extension" class="">https://github.com/llvm-mirror/clang/compare/master...potswa:lifetime_extension</a></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>- Thx,</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>David</div><div class=""><br class=""></div></body></html>