brintos

brintos / llvm-project-archived public Read only

0
0
Text · 580 B · 2a140a8 Raw
23 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-macos11 -fsyntax-only -fobjc-arc -fblocks -verify -Wunused-but-set-variable -Wno-objc-root-class %s2 3id getFoo(void);4 5void test() {6  // no diagnostics for objects with precise lifetime semantics.7  __attribute__((objc_precise_lifetime)) id x;8  x = getFoo();9 10  id x2; // expected-warning {{variable 'x2' set but not used}}11  x2 = getFoo();12 13  do {14    __attribute__((objc_precise_lifetime)) id y;15    y = getFoo();16 17    id y2; // expected-warning {{variable 'y2' set but not used}}18    y2 = getFoo();19  } while(0);20 21  x = ((void *)0);22}23