mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-04 16:41:43 +00:00
Accesses to a collection within a fast enumeration 'for' statement constitute a 'use'.
llvm-svn: 59075
This commit is contained in:
parent
38c9a14a88
commit
3b4e1d5cc6
@ -176,18 +176,24 @@ void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
|
|||||||
else VisitStmt(B);
|
else VisitStmt(B);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferFuncs::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
|
void TransferFuncs::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
|
||||||
Stmt* Element = S->getElement();
|
// This represents a 'use' of the collection.
|
||||||
|
Visit(S->getCollection());
|
||||||
if (DeclStmt* DS = dyn_cast<DeclStmt>(Element)) {
|
|
||||||
VisitDeclStmt(DS);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This represents a 'kill' for the variable.
|
// This represents a 'kill' for the variable.
|
||||||
DeclRefExpr* DR = cast<DeclRefExpr>(Element);
|
Stmt* Element = S->getElement();
|
||||||
LiveState(cast<VarDecl>(DR->getDecl()), AD) = Dead;
|
DeclRefExpr *DR;
|
||||||
if (AD.Observer) { AD.Observer->ObserverKill(DR); }
|
VarDecl* VD = 0;
|
||||||
|
|
||||||
|
if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
|
||||||
|
VD = cast<VarDecl>(DS->getSolitaryDecl());
|
||||||
|
else {
|
||||||
|
DR = cast<DeclRefExpr>(Element);
|
||||||
|
VD = cast<VarDecl>(DR->getDecl());
|
||||||
|
}
|
||||||
|
|
||||||
|
LiveState(VD, AD) = Dead;
|
||||||
|
if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user