Yes, you are correct: clang implicitly marks indirect parameters with
__autoreleasing.
The whole purpose of Wblock-capture-autoreleasing (which was committed in
r285031) is to inform the users that clang has implicitly marked an
out-parameter as __autoreleasing. clang doesn’t warn if the user
If I'm understanding you correctly, you're saying that clang implicitly
marks the indirect NSError** parameter with __autoreleasing, so there's no
bug here. Is that correct? If so, should Wblock-capture-autoreleasing just
not fire on parameters that are already implicitly marked as
Hi Nico,
The documentation might confuse people now that the warning is on by default,
but it’s correct as clang still qualifies indirect parameters with
__autoreleasing. We had to add this warning and turn it on by default because a
lot of people capture indirect parameters in their code not
Hi Akira,
this fires in internal chrome/ios code like so:
somefile.m: error: block captures an autoreleasing out-parameter, which may
result in use-after-free bugs [-Werror,-Wblock-capture-autoreleasing]
if (error) {
^
somefile.m: note: declare the parameter
Author: ahatanak
Date: Thu Jan 26 12:51:10 2017
New Revision: 293199
URL: http://llvm.org/viewvc/llvm-project?rev=293199=rev
Log:
Turn on -Wblock-capture-autoreleasing by default.
Turning on the warning by default helps the users as it's a common
mistake to capture out-parameters in a block