[cfe-commits] r138528 - /cfe/trunk/lib/CodeGen/CGDecl.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Aug 24 17:06:26 PDT 2011
Author: fjahanian
Date: Wed Aug 24 19:06:26 2011
New Revision: 138528
URL: http://llvm.org/viewvc/llvm-project?rev=138528&view=rev
Log:
blocks - capturing logic of byref block variable's expression
statement initializer makes safe assumption when a substatement
is encounterred (with a fix me).
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=138528&r1=138527&r2=138528&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Aug 24 19:06:26 2011
@@ -879,9 +879,25 @@
const CompoundStmt *CS = SE->getSubStmt();
for (CompoundStmt::const_body_iterator BI = CS->body_begin(),
BE = CS->body_end(); BI != BE; ++BI)
- if (Expr *E = dyn_cast<Expr>((*BI)))
+ if (Expr *E = dyn_cast<Expr>((*BI))) {
if (isCapturedBy(var, E))
return true;
+ }
+ else if (DeclStmt *DS = dyn_cast<DeclStmt>((*BI))) {
+ // special case declarations
+ for (DeclStmt::decl_iterator I = DS->decl_begin(), E = DS->decl_end();
+ I != E; ++I) {
+ if (VarDecl *VD = dyn_cast<VarDecl>((*I))) {
+ Expr *Init = VD->getInit();
+ if (Init && isCapturedBy(var, Init))
+ return true;
+ }
+ }
+ }
+ else
+ // FIXME. Make safe assumption assuming arbitrary statements cause capturing.
+ // Later, provide code to poke into statements for capture analysis.
+ return true;
return false;
}
More information about the cfe-commits
mailing list