diff options
author | Julian Büning <julian.buening@rwth-aachen.de> | 2020-10-10 15:13:06 +0200 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-11-12 10:13:54 +0000 |
commit | c763a4087f1d8fa4dbdfb9c8f30d545cdb66a0aa (patch) | |
tree | 5d40c27ecfb16230aa3e714a3e7690b44b322860 /lib/Core | |
parent | acdb9a692d9eee8dd102befa4e101bfa5f028b0e (diff) | |
download | klee-c763a4087f1d8fa4dbdfb9c8f30d545cdb66a0aa.tar.gz |
Ref: implement operator bool()
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/ExecutionState.cpp | 2 | ||||
-rw-r--r-- | lib/Core/Executor.cpp | 6 | ||||
-rw-r--r-- | lib/Core/Memory.cpp | 6 | ||||
-rw-r--r-- | lib/Core/SpecialFunctionHandler.cpp | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/Core/ExecutionState.cpp b/lib/Core/ExecutionState.cpp index 62376db6..97f97a8b 100644 --- a/lib/Core/ExecutionState.cpp +++ b/lib/Core/ExecutionState.cpp @@ -283,7 +283,7 @@ bool ExecutionState::merge(const ExecutionState &b) { for (unsigned i=0; i<af.kf->numRegisters; i++) { ref<Expr> &av = af.locals[i].value; const ref<Expr> &bv = bf.locals[i].value; - if (av.isNull() || bv.isNull()) { + if (!av || !bv) { // if one is null then by implication (we are at same pc) // we cannot reuse this local, so just ignore } else { diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index e3e33aa2..13c25076 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -3048,11 +3048,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { r = ExtractExpr::create(agg, rOffset, agg->getWidth() - rOffset); ref<Expr> result; - if (!l.isNull() && !r.isNull()) + if (l && r) result = ConcatExpr::create(r, ConcatExpr::create(val, l)); - else if (!l.isNull()) + else if (l) result = ConcatExpr::create(val, l); - else if (!r.isNull()) + else if (r) result = ConcatExpr::create(r, val); else result = val; diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index bf00ee4b..86b06701 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -135,7 +135,7 @@ ObjectState::~ObjectState() { } ArrayCache *ObjectState::getArrayCache() const { - assert(!object.isNull() && "object was NULL"); + assert(object && "object was NULL"); return object->parent->getArrayCache(); } @@ -149,7 +149,7 @@ const UpdateList &ObjectState::getUpdates() const { // FIXME: We should be able to do this more efficiently, we just need to be // careful to get the interaction with the cache right. In particular we // should avoid creating UpdateNode instances we never use. - unsigned NumWrites = updates.head.isNull() ? 0 : updates.head->getSize(); + unsigned NumWrites = updates.head ? updates.head->getSize() : 0; std::vector< std::pair< ref<Expr>, ref<Expr> > > Writes(NumWrites); const auto *un = updates.head.get(); for (unsigned i = NumWrites; i != 0; un = un->next.get()) { @@ -219,7 +219,7 @@ void ObjectState::makeConcrete() { } void ObjectState::makeSymbolic() { - assert(updates.head.isNull() && + assert(!updates.head && "XXX makeSymbolic of objects with symbolic values is unsupported"); // XXX simplify this, can just delete various arrays I guess diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index 6d54eb22..153619d3 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -464,7 +464,7 @@ void SpecialFunctionHandler::handleEhUnwindRaiseExceptionImpl( "invalid number of arguments to _klee_eh_Unwind_RaiseException_impl"); ref<ConstantExpr> exceptionObject = dyn_cast<ConstantExpr>(arguments[0]); - if (!exceptionObject.get()) { + if (!exceptionObject) { executor.terminateStateOnError(state, "Internal error: Symbolic exception pointer", Executor::Unhandled); |