summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-05 10:21:48 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-05 10:21:48 +0000
commit64e9aa5c93d54bd26d0e8d337a2fb48979eaafa2 (patch)
treef4cb397461a63ca9ced0a07d0cc1e90087eaa941 /llvm/lib/Analysis
parent96c9d95f5174bebe02583e40683fd6e05b649d59 (diff)
downloadbcm5719-llvm-64e9aa5c93d54bd26d0e8d337a2fb48979eaafa2.tar.gz
bcm5719-llvm-64e9aa5c93d54bd26d0e8d337a2fb48979eaafa2.zip
[C++11] Make this interface accept const Use pointers and use override
to ensure we don't mess up any of the overrides. Necessary for cleaning up the Value use iterators and enabling range-based traversing of use lists. llvm-svn: 202958
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp4
-rw-r--r--llvm/lib/Analysis/CaptureTracking.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 8f2ddb5507d..36ed40d3549 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -372,7 +372,7 @@ namespace {
void tooManyUses() override { Captured = true; }
- bool shouldExplore(Use *U) override {
+ bool shouldExplore(const Use *U) override {
Instruction *I = cast<Instruction>(U->getUser());
BasicBlock *BB = I->getParent();
// We explore this usage only if the usage can reach "BeforeHere".
@@ -388,7 +388,7 @@ namespace {
return true;
}
- bool captured(Use *U) override {
+ bool captured(const Use *U) override {
Instruction *I = cast<Instruction>(U->getUser());
BasicBlock *BB = I->getParent();
// Same logic as in shouldExplore.
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index 1e864b29547..60978470d2b 100644
--- a/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/llvm/lib/Analysis/CaptureTracking.cpp
@@ -28,7 +28,7 @@ using namespace llvm;
CaptureTracker::~CaptureTracker() {}
-bool CaptureTracker::shouldExplore(Use *U) { return true; }
+bool CaptureTracker::shouldExplore(const Use *U) { return true; }
namespace {
struct SimpleCaptureTracker : public CaptureTracker {
@@ -37,7 +37,7 @@ namespace {
void tooManyUses() override { Captured = true; }
- bool captured(Use *U) override {
+ bool captured(const Use *U) override {
if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
return false;
@@ -81,8 +81,8 @@ static int const Threshold = 20;
void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker) {
assert(V->getType()->isPointerTy() && "Capture is for pointers only!");
- SmallVector<Use*, Threshold> Worklist;
- SmallSet<Use*, Threshold> Visited;
+ SmallVector<const Use *, Threshold> Worklist;
+ SmallSet<const Use *, Threshold> Visited;
int Count = 0;
for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
@@ -99,7 +99,7 @@ void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker) {
}
while (!Worklist.empty()) {
- Use *U = Worklist.pop_back_val();
+ const Use *U = Worklist.pop_back_val();
Instruction *I = cast<Instruction>(U->getUser());
V = U->get();
OpenPOWER on IntegriCloud