This patch uses diagnose_if to attempt to catch null inputs in std::string. Note that unlike __attribute__((non_null)) diagnose_if does not affect codegen.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
would it be better to internally treat attribute((non_null)) like diagnose_if ? then you get all the warnings for free?
Comment Actions
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.