aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-08-22 19:00:43 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-13 20:39:49 +0000
commitfe6060f10f634930ff71b7c50291ddc610da2475 (patch)
tree1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp
parentb61bce17f346d79cecfd8f195a64b10f77be43b1 (diff)
parent344a3780b2e33f6ca763666c380202b18aab72a3 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp')
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp b/contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp
index 6228ff2bae98..a703f42f14c3 100644
--- a/contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-diff/DiffConsumer.cpp
@@ -17,34 +17,33 @@
using namespace llvm;
-static void ComputeNumbering(Function *F, DenseMap<Value*,unsigned> &Numbering){
+static void ComputeNumbering(const Function *F,
+ DenseMap<const Value *, unsigned> &Numbering) {
unsigned IN = 0;
// Arguments get the first numbers.
- for (Function::arg_iterator
- AI = F->arg_begin(), AE = F->arg_end(); AI != AE; ++AI)
- if (!AI->hasName())
- Numbering[&*AI] = IN++;
+ for (const auto &Arg : F->args())
+ if (!Arg.hasName())
+ Numbering[&Arg] = IN++;
// Walk the basic blocks in order.
- for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI) {
- if (!FI->hasName())
- Numbering[&*FI] = IN++;
+ for (const auto &Func : *F) {
+ if (!Func.hasName())
+ Numbering[&Func] = IN++;
// Walk the instructions in order.
- for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI)
+ for (const auto &BB : Func)
// void instructions don't get numbers.
- if (!BI->hasName() && !BI->getType()->isVoidTy())
- Numbering[&*BI] = IN++;
+ if (!BB.hasName() && !BB.getType()->isVoidTy())
+ Numbering[&BB] = IN++;
}
assert(!Numbering.empty() && "asked for numbering but numbering was no-op");
}
-
void Consumer::anchor() { }
-void DiffConsumer::printValue(Value *V, bool isL) {
+void DiffConsumer::printValue(const Value *V, bool isL) {
if (V->hasName()) {
out << (isa<GlobalValue>(V) ? '@' : '%') << V->getName();
return;
@@ -99,16 +98,16 @@ void DiffConsumer::header() {
// Extra newline between functions.
if (Differences) out << "\n";
- Function *L = cast<Function>(I->L);
- Function *R = cast<Function>(I->R);
+ const Function *L = cast<Function>(I->L);
+ const Function *R = cast<Function>(I->R);
if (L->getName() != R->getName())
out << "in function " << L->getName()
<< " / " << R->getName() << ":\n";
else
out << "in function " << L->getName() << ":\n";
} else if (isa<BasicBlock>(I->L)) {
- BasicBlock *L = cast<BasicBlock>(I->L);
- BasicBlock *R = cast<BasicBlock>(I->R);
+ const BasicBlock *L = cast<BasicBlock>(I->L);
+ const BasicBlock *R = cast<BasicBlock>(I->R);
if (L->hasName() && R->hasName() && L->getName() == R->getName())
out << " in block %" << L->getName() << ":\n";
else {
@@ -139,7 +138,7 @@ bool DiffConsumer::hadDifferences() const {
return Differences;
}
-void DiffConsumer::enterContext(Value *L, Value *R) {
+void DiffConsumer::enterContext(const Value *L, const Value *R) {
contexts.push_back(DiffContext(L, R));
Indent += 2;
}