Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some non-ret and unused var warning #1396

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions svf-llvm/lib/LLVMUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ void LLVMUtil::getPrevInsts(const Instruction* curInst, std::vector<const SVFIns
*/
const Value* LLVMUtil::getFirstUseViaCastInst(const Value* val)
{
const PointerType * type = SVFUtil::dyn_cast<PointerType>(val->getType());
assert(type && "this value should be a pointer type!");
assert(SVFUtil::isa<PointerType>(val->getType()) && "this value should be a pointer type!");
/// If type is void* (i8*) and val is immediately used at a bitcast instruction
const Value *latestUse = nullptr;
for (const auto &it : val->uses())
Expand Down
2 changes: 1 addition & 1 deletion svf-llvm/lib/SVFIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ bool SVFIRBuilder::computeGepOffset(const User *V, AccessPath& ap)

assert((prevPtrOperand && svfGepTy->isPointerTy()) == false &&
"Expect no more than one gep operand to be of a pointer type");
if(svfGepTy->isPointerTy()) prevPtrOperand = true;
if(!prevPtrOperand && svfGepTy->isPointerTy()) prevPtrOperand = true;
const Value* offsetVal = gi.getOperand();
const SVFValue* offsetSvfVal = LLVMModuleSet::getLLVMModuleSet()->getSVFValue(offsetVal);
assert(gepTy != offsetVal->getType() && "iteration and operand have the same type?");
Expand Down
3 changes: 1 addition & 2 deletions svf-llvm/tools/AE/ae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,10 @@ int main(int argc, char** argv)
arg_value[arg_num] = argv[arg_num];
}
// add extra options
int orgArgNum = arg_num;
arg_value[arg_num++] = (char*) "-model-consts=true";
arg_value[arg_num++] = (char*) "-model-arrays=true";
arg_value[arg_num++] = (char*) "-pre-field-sensitive=false";
assert(arg_num == (orgArgNum + extraArgc) && "more extra arguments? Change the value of extraArgc");
assert(arg_num == (argc + extraArgc) && "more extra arguments? Change the value of extraArgc");

std::vector<std::string> moduleNameVec;
moduleNameVec = OptionBase::parseOptions(
Expand Down
1 change: 1 addition & 0 deletions svf/include/Graphs/WTO.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "SVFIR/SVFType.h"
#include "SVFIR/SVFValue.h"
#include <functional>

namespace SVF
{
Expand Down
1 change: 1 addition & 0 deletions svf/lib/AE/Svfexe/AbstractExecution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ u32_t AEAPI::getAllocaInstByteSize(const AddrStmt *addr)
}
}
assert (false && "Addr rhs value is not ObjVar");
abort();
}

IntervalValue AEAPI::traceMemoryAllocationSize(const SVFValue *value)
Expand Down
1 change: 1 addition & 0 deletions svf/lib/AE/Svfexe/BufOverflowChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ bool BufOverflowCheckerAPI::detectStrcat(const CallICFGNode *call)
else
{
assert(false && "unknown strcat function, please add it to strcatGroup or strncatGroup");
abort();
}
}

Expand Down
3 changes: 1 addition & 2 deletions svf/lib/AE/Svfexe/ICFGSimplification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ void ICFGSimplification::mergeAdjacentNodes(ICFG* icfg)
// merge the following nodes, until the next subnode
while (subNodes.find(next) == subNodes.end())
{
ICFGNode* rep_next = const_cast<ICFGNode*>(icfg->getRepNode(next));
assert(rep_next != head && "should not find a circle here");
assert(icfg->getRepNode(next) != head && "should not find a circle here");
icfg->removeICFGEdge(*head->getOutEdges().begin());
std::vector<ICFGEdge*> rm_edges;
// Step 1: merge the out edges of next to head
Expand Down
1 change: 1 addition & 0 deletions svf/lib/AE/Svfexe/SVFIR2ItvExeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ IntervalValue SVFIR2ItvExeState::getRangeLimitFromType(const SVFType* type)
else
{
assert(false && "cannot support");
abort();
}
}

Expand Down
11 changes: 5 additions & 6 deletions svf/lib/MemoryModel/AccessPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,16 @@
{
const SVFValue* idxValue = idxOperandVar->getValue();
u32_t structByteOffset = 0;
if (const SVFConstantInt *op = SVFUtil::dyn_cast<SVFConstantInt>(idxValue))
{
for (u32_t structField = 0; structField < (u32_t)op->getSExtValue(); ++structField)
{
if (const SVFConstantInt *op = SVFUtil::dyn_cast<SVFConstantInt>(idxValue)) {
for (u32_t structField = 0; structField < (u32_t) op->getSExtValue(); ++structField) {

Check warning on line 169 in svf/lib/MemoryModel/AccessPath.cpp

View check run for this annotation

Codecov / codecov/patch

svf/lib/MemoryModel/AccessPath.cpp#L168-L169

Added lines #L168 - L169 were not covered by tests
u32_t flattenIdx = idxOperandType->getTypeInfo()->getFlattenedFieldIdxVec()[structField];
structByteOffset += idxOperandType->getTypeInfo()->getOriginalElemType(flattenIdx)->getByteSize();
}
return structByteOffset;
}
else
} else {
assert(false && "struct type can only pair with constant idx");
abort();
}
}

/// Return accumulated constant offset
Expand Down
Loading