aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Expr/ArrayExprRewriter.cpp
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2018-10-18 13:51:21 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-10-23 18:53:46 +0300
commit8bfd97d583e932973f0d363f8cfd695ecb5e002e (patch)
treef8791168bf0771df1ab3596e942e80fb751e0e7d /lib/Expr/ArrayExprRewriter.cpp
parente13f4d5ea1201361ec96aa96afec7b5604c52082 (diff)
downloadklee-8bfd97d583e932973f0d363f8cfd695ecb5e002e.tar.gz
Modernize code
* use `using` instead of typdef * use `collection.empty()` instead of size * use `auto` if clear * use `emplace_back` where useful * use `nullptr` instead of NULL * use `override` if applicable * use `explicit` for constructor to avoid implicit conversion
Diffstat (limited to 'lib/Expr/ArrayExprRewriter.cpp')
-rw-r--r--lib/Expr/ArrayExprRewriter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Expr/ArrayExprRewriter.cpp b/lib/Expr/ArrayExprRewriter.cpp
index 507ea753..7bbadd61 100644
--- a/lib/Expr/ArrayExprRewriter.cpp
+++ b/lib/Expr/ArrayExprRewriter.cpp
@@ -43,13 +43,13 @@ ref<Expr> ExprRewriter::rewrite(const ref<Expr> &e, const array2idx_ty &arrays,
"Read is not aligned");
Expr::Width width = idxt_v.getWidth() / element.first->range;
- if (idxt_v.getMul().get()) {
+ if (!idxt_v.getMul().isNull()) {
// If we have a MulExpr in the index, we can optimize our search by
// skipping all those indexes that are not multiple of such value.
// In fact, they will be rejected by the MulExpr interpreter since it
// will not find any integer solution
Expr &e = *idxt_v.getMul();
- ConstantExpr &ce = static_cast<ConstantExpr &>(e);
+ auto &ce = static_cast<ConstantExpr &>(e);
llvm::APInt val = ce.getAPValue();
uint64_t mulVal = val.getZExtValue();
// So far we try to limit this optimization, but we may try some more
@@ -64,7 +64,7 @@ ref<Expr> ExprRewriter::rewrite(const ref<Expr> &e, const array2idx_ty &arrays,
continue;
}
auto opt_indexes = idx_valIdx.at((*index_it));
- if (opt_indexes.size() == 0) {
+ if (opt_indexes.empty()) {
// We continue with other solutions
continue;
} else if (opt_indexes.size() == 1) {
@@ -76,7 +76,7 @@ ref<Expr> ExprRewriter::rewrite(const ref<Expr> &e, const array2idx_ty &arrays,
unsigned set = 0;
BitArray ba(arr->size / width);
for (auto &vals : opt_indexes) {
- ConstantExpr &ce = static_cast<ConstantExpr &>(*vals);
+ auto &ce = static_cast<ConstantExpr &>(*vals);
llvm::APInt v = ce.getAPValue();
ba.set(v.getZExtValue() / width);
set++;
@@ -120,7 +120,7 @@ ref<Expr> ExprRewriter::rewrite(const ref<Expr> &e, const array2idx_ty &arrays,
}
}
}
- if (eqExprs.size() == 0) {
+ if (eqExprs.empty()) {
return notFound;
} else if (eqExprs.size() == 1) {
if (isa<AndExpr>(eqExprs[0])) {