view clang/test/Analysis/objc-live-crash.mm @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children
line wrap: on
line source

// RUN: %clang --analyze %s -fblocks

// https://reviews.llvm.org/D82598#2171312

@interface Item
// ...
@end

@interface Collection
// ...
@end

typedef void (^Blk)();

struct RAII {
  Blk blk;

public:
  RAII(Blk blk): blk(blk) {}
  ~RAII() { blk(); }
};

void foo(Collection *coll) {
  RAII raii(^{});
  for (Item *item in coll) {}
  int i;
  {
    int j;
  }
}