}
void TransferFunctions::VisitBlockExpr(BlockExpr *BE) {
- AnalysisDeclContext::referenced_decls_iterator I, E;
- llvm::tie(I, E) =
- LV.analysisContext.getReferencedBlockVars(BE->getBlockDecl());
- for ( ; I != E ; ++I) {
- const VarDecl *VD = *I;
+ const BlockDecl *BD = BE->getBlockDecl();
+ for (BlockDecl::capture_const_iterator it = BD->capture_begin(),
+ ei = BD->capture_end(); it != ei; ++it) {
+ const VarDecl *VD = it->getVariable();
if (isAlwaysAlive(VD))
continue;
val.liveDecls = LV.DSetFact.add(val.liveDecls, VD);
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores,osx.cocoa.RetainCount -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores,osx.cocoa.RetainCount -fblocks -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
}
@end
+// Don't flag dead stores when a variable is captured in a block used
+// by a property access.
+@interface RDar10591355
+@property (assign) int x;
+@end
+
+RDar10591355 *rdar10591355_aux();
+
+void rdar10591355() {
+ RDar10591355 *p = rdar10591355_aux();
+ ^{ (void) p.x; }();
+}