File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,8 @@ bool tryToFindPtrOrigin(
9393 if (auto *call = dyn_cast<CallExpr>(E)) {
9494 if (auto *Callee = call->getCalleeDecl ()) {
9595 if (Callee->hasAttr <CFReturnsRetainedAttr>() ||
96- Callee->hasAttr <NSReturnsRetainedAttr>()) {
96+ Callee->hasAttr <NSReturnsRetainedAttr>() ||
97+ Callee->hasAttr <NSReturnsAutoreleasedAttr>()) {
9798 return callback (E, true );
9899 }
99100 }
Original file line number Diff line number Diff line change @@ -567,6 +567,17 @@ void foo() {
567567
568568} // namespace ns_retained_return_value
569569
570+ namespace autoreleased {
571+
572+ NSString *provideAutoreleased () __attribute__((ns_returns_autoreleased));
573+ void consume (NSString *);
574+
575+ void foo () {
576+ consume (provideAutoreleased ());
577+ }
578+
579+ } // autoreleased
580+
570581@interface TestObject : NSObject
571582- (void )doWork : (NSString *)msg , ...;
572583- (void )doWorkOnSelf ;
Original file line number Diff line number Diff line change @@ -535,6 +535,18 @@ unsigned foo() {
535535
536536} // namespace ns_retained_return_value
537537
538+ namespace autoreleased {
539+
540+ NSString *provideAutoreleased () __attribute__((ns_returns_autoreleased));
541+ void consume (NSString *);
542+
543+ void foo () {
544+ auto *string = provideAutoreleased ();
545+ consume (string);
546+ }
547+
548+ } // autoreleased
549+
538550bool doMoreWorkOpaque (OtherObj*);
539551SomeObj* provide ();
540552
You can’t perform that action at this time.
0 commit comments