Unverified Commit c68a9d25 authored by Tacet's avatar Tacet Committed by GitHub
Browse files

[ASan][libc++] String annotations optimizations fix with lambda (#76200)

This commit addresses optimization and instrumentation challenges
encountered within comma constructors.
1) _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS does not work in comma
constructors.
2) Code inside comma constructors is not always correctly optimized.
Problematic code examples:
- `: __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)),
std::move(__str.__r_))) {`
- `: __r_(__r_([&](){ if(!__s.__is_long()) __s.__annotate_delete();
return std::move(__s.__r_);}())) {`

However, lambda with argument seems to be correctly optimized. The patch employs this.

Use of lambda based on an idea from @ldionne.
parent 0e7199cf
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment