Cy-4AH added a comment.

Hello!

What compiler do when call doStuff:

  NSString * __strong fillMe;
  NSString * __autoreleasing autorelesingFillMe = fillMe;
  doStuff(&fillMe);
  fillMe = autoreleasingFillMe;

Why it's not making the same thing in doStuff body?
Compiler generated code for yours example should be:

  void doStuff(NSString **fillMeIn) {
      __block NSString *fillMeInResult;
      __block BOOL fillMeInResultHasChanged = NO;
      [@[@"array"] enumerateObjectsUsingBlock:
        ^(id obj, NSUInteger idx, BOOL* stop) {
          *stop = YES;
          fillMeInResult = [@"wow" mutableCopy];
          fillMeInResultHasChanged = YES;
        }
      ];
      if (fillMeInResultHasChanged) {
        *fillMeIn = fillMeInResult;
      }
  }

Instead we got this warning and had to do the same stuff in every implementation


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D25844/new/

https://reviews.llvm.org/D25844

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D25844: [Sema]... Anatoly Shcherbinin via Phabricator via cfe-commits

Reply via email to