[PATCH] D28716: [libc++] Diagnose null inputs in std::string using _LIBCPP_DIAGNOSE_WARNING
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 13 22:30:30 PST 2017
EricWF added a comment.
In https://reviews.llvm.org/D28716#646274, @grandinj wrote:
> would it be better to internally treat __attribute__((non_null)) like diagnose_if ? then you get all the warnings for free?
There were previous objections about using `non_null` within libc++ due to the affect on code gen. That's why I choose to use diagose_if here.
However the previous objections weren't about `std::string`, so maybe the consensus would be different here? I'll ping @mclow.lists about this.
Note: Some of these non-null diagnostics depend on the second condition `size > 0`, which can't be done with non-null.
More information about the cfe-commits