Give CaptureTracker::shouldExplore a base implementation. Most users want to do

the same thing. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2012-10-08 22:12:48 +00:00
parent 6be75ae196
commit c92b8aa79f
3 changed files with 3 additions and 5 deletions

View File

@ -46,7 +46,7 @@ namespace llvm {
/// capture) return false. To search it, return true. /// capture) return false. To search it, return true.
/// ///
/// U->getUser() is always an Instruction. /// U->getUser() is always an Instruction.
virtual bool shouldExplore(Use *U) = 0; virtual bool shouldExplore(Use *U);
/// captured - Information about the pointer was captured by the user of /// captured - Information about the pointer was captured by the user of
/// use U. Return true to stop the traversal or false to continue looking /// use U. Return true to stop the traversal or false to continue looking

View File

@ -23,6 +23,8 @@ using namespace llvm;
CaptureTracker::~CaptureTracker() {} CaptureTracker::~CaptureTracker() {}
bool CaptureTracker::shouldExplore(Use *U) { return true; }
namespace { namespace {
struct SimpleCaptureTracker : public CaptureTracker { struct SimpleCaptureTracker : public CaptureTracker {
explicit SimpleCaptureTracker(bool ReturnCaptures) explicit SimpleCaptureTracker(bool ReturnCaptures)
@ -30,8 +32,6 @@ namespace {
void tooManyUses() { Captured = true; } void tooManyUses() { Captured = true; }
bool shouldExplore(Use *U) { return true; }
bool captured(Use *U) { bool captured(Use *U) {
if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures) if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
return false; return false;

View File

@ -276,8 +276,6 @@ namespace {
void tooManyUses() { Captured = true; } void tooManyUses() { Captured = true; }
bool shouldExplore(Use *U) { return true; }
bool captured(Use *U) { bool captured(Use *U) {
CallSite CS(U->getUser()); CallSite CS(U->getUser());
if (!CS.getInstruction()) { Captured = true; return true; } if (!CS.getInstruction()) { Captured = true; return true; }