Skip to content

Commit 077b94e

Browse files
committed
[fix] Small fixes
1 parent a428b7c commit 077b94e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/Core/MockBuilder.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ void MockBuilder::buildExternalFunctionsDefinitions() {
193193
llvm::BasicBlock::Create(mockModule->getContext(), "entry", func);
194194
builder->SetInsertPoint(BB);
195195

196-
if (!func->getReturnType()->isSized()) {
197-
builder->CreateRet(nullptr);
198-
continue;
199-
}
200196

201197
const auto nameToAnnotations = annotations.find(extName);
202198
if (nameToAnnotations != annotations.end()) {
@@ -319,6 +315,7 @@ bool tryAlign(llvm::Function *func,
319315
const std::vector<std::vector<Statement::Ptr>> &statements,
320316
std::vector<std::vector<Statement::Ptr>> &res) {
321317
if (func->arg_size() == statements.size()) {
318+
res = statements;
322319
return true;
323320
}
324321

@@ -411,6 +408,10 @@ void MockBuilder::buildAnnotationForExternalFunctionArgs(
411408
void MockBuilder::buildAnnotationForExternalFunctionReturn(
412409
llvm::Function *func, const std::vector<Statement::Ptr> &statements) {
413410
auto returnType = func->getReturnType();
411+
if (!returnType->isSized()) { // void return type
412+
builder->CreateRet(nullptr);
413+
return;
414+
}
414415
std::string retName = "ret_" + func->getName().str();
415416

416417
auto *mockReturnValue = builder->CreateAlloca(returnType, nullptr);

lib/Module/Annotation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ void Unknown::initOffset() {
6363
case '[': {
6464
size_t posEndExpr = offsetStr.find(']', pos);
6565
if (posEndExpr == std::string::npos) {
66-
klee_error("Annotation: Incorrect offset format \"%s\"", str.c_str());
66+
klee_warning("Annotation: Incorrect offset format \"%s\"", str.c_str());
67+
continue;
6768
}
6869
offset.push_back(offsetStr.substr(pos + 1, posEndExpr - 1 - pos));
6970
pos = posEndExpr;
7071
break;
7172
}
7273
default: {
73-
klee_error("Annotation: Incorrect offset format \"%s\"", str.c_str());
74+
klee_warning("Annotation: Incorrect offset format \"%s\"", str.c_str());
75+
continue;
7476
}
7577
}
7678
}

0 commit comments

Comments
 (0)