}
// If ARC Annotations are enabled, output the current state of pointers at the
- // bottom of the basic block.
+ // bottom of the basic block.
ANNOTATE_BOTTOMUP_BBEND(MyStates, BB);
-
+
// Visit all the instructions, bottom-up.
for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; --I) {
Instruction *Inst = llvm::prior(I);
// If ARC Annotations are enabled, output the current state of pointers at the
// top of the basic block.
ANNOTATE_BOTTOMUP_BBSTART(MyStates, BB);
-
+
return NestingDetected;
}
// If ARC Annotations are enabled, output the current state of pointers at the
// top of the basic block.
ANNOTATE_TOPDOWN_BBSTART(MyStates, BB);
-
+
// Visit all the instructions, top-down.
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
Instruction *Inst = I;
NestingDetected |= VisitInstructionTopDown(Inst, Releases, MyStates);
}
-
+
// If ARC Annotations are enabled, output the current state of pointers at the
// bottom of the basic block.
ANNOTATE_TOPDOWN_BBEND(MyStates, BB);
-
+
CheckForCFGHazards(BB, BBStates, MyStates);
return NestingDetected;
}
NestingDetected;
}
-// Check if there is a dependent call earlier that does not have anything in
-// between the Retain and the call that can affect the reference count of their
-// shared pointer argument. Note that Retain need not be in BB.
+/// Check if there is a dependent call earlier that does not have anything in
+/// between the Retain and the call that can affect the reference count of their
+/// shared pointer argument. Note that Retain need not be in BB.
static bool
HasSafePathToPredecessorCall(const Value *Arg, Instruction *Retain,
SmallPtrSet<Instruction *, 4> &DepInsts,
DepInsts, Visited, PA);
if (DepInsts.size() != 1)
return false;
-
+
CallInst *Call =
dyn_cast_or_null<CallInst>(*DepInsts.begin());
-
+
// Check that the pointer is the return value of the call.
if (!Call || Arg != Call)
return false;
-
+
// Check that the call is a regular call.
InstructionClass Class = GetBasicInstructionClass(Call);
if (Class != IC_CallOrUser && Class != IC_Call)
return false;
-
+
return true;
}
DependingInstructions.clear();
Visited.clear();
-
+
// Check that there is nothing that can affect the reference count
// between the retain and the call. Note that Retain need not be in BB.
if (HasSafePathToPredecessorCall(Arg, Retain, DependingInstructions,