<div dir="ltr">Your lambda doesn't capture anything -- maybe use [] rather than [&]? (Maybe we should warn on this.)<div><br></div><div>Maybe use a reverse_iterator loop over FD->getAttrs, and skip the non-EnableIfAttrs. That'd remove the need to make a copy of the vector and to reverse it. (Do we have llvm::reversed yet? If so, 'for (Attr *A : reversed(FD->getAttrs()))' seems like a nice way to write this.)</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 9, 2014 at 5:02 PM, Nick Lewycky <span dir="ltr"><<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On 03/09/2014 11:01 AM, David Majnemer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Your std::remove_if would be more concise if it used a lambda instead<br>
of IsNotEnableIfAttr.<br>
</blockquote>
<br></div>
Done. Also added another test case to the mangling tests.<br>
<br>
Nick<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
On Sun Mar 09 2014 at 10:30:45 AM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a><br></div><div><div class="h5">
<mailto:<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>>> wrote:<br>
<br>
    The attached mangle-enable_if-1.patch adds a mangling for<br>
    __attribute__((enable_if(expr, string-literal))) to clang.<br>
<br>
    demangle-enable_if-1.patch adds support to libcxxabi's demangler. This<br>
    patch I'm not very confident in. libcxxabi's cxa_demangle lacks comments<br>
    and assertions, leaving its design criteria a mystery. I think the<br>
    functions return 'first' in case of error. I added a vector<> inside the<br>
    demangler, I don't know whether that's OK because it means doing<br>
    allocation. I don't know what the two strings in the pair in db.names<br>
    are for, but the first one appears to be the demangling so I put it<br>
    there. I don't understand what the members in 'db' are for, since they<br>
    aren't commented (db.tag_templates?). The code is cargo culted from<br>
    parse_template_args and simplified down by making wild assumptions<br>
    (db.tag_templates is always false!) and constant folding.<br>
<br>
    Also the demangler seems pretty buggy. It wraps expressions in extra<br>
    parentheses which don't correspond to pi .. E expressions (if you were<br>
    to remangle it, you'd get the extra pi .. E). A mangling for "&function"<br>
    ends up demangling "&(function())" which has different semantic meaning.<br>
       I'm assuming these problems are pre-existing. While "_Z3foo"<br>
    demangles<br>
    to "foo" and "_Z3foov" demangles to "foo()", the same things with an<br>
    attribute demangle to include parens. For example, "_Z3fooUa3bar" and<br>
    "_Z3fooUa3barv" both demangle to "foo() __attribute__((bar))", never<br>
    "foo __attribute__((bar))".<br>
<br>
    Finally, I've never even compiled the change to the tests. I have tested<br>
    those exact manglings and seen what cxa_demangle does to them, but it<br>
    was easier to write a standalone tool than to deal with "testit".<br>
<br>
    Please review!<br>
<br>
    Nick<br></div></div>
    ______________________________<u></u>___________________<br>
    cfe-commits mailing list<br>
    <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.<u></u>edu</a>><br>
    <a href="http://lists.cs.uiuc.edu/__mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/__<u></u>mailman/listinfo/cfe-commits</a><br>
    <<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a>><br>
<br>
</blockquote>
<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>