Introduce -Wunreachable-code-break

This commit is contained in:
Alessandro Di Federico
2024-10-18 11:19:42 +02:00
parent a0ffb42910
commit 36e2faad3d
13 changed files with 70 additions and 84 deletions
+4 -5
View File
@@ -252,7 +252,6 @@ handleReturnValue(const model::TypeDefinition &Prototype,
revng_assert(Layout.ReturnValues.size() == 1);
revng_assert(Layout.ReturnValues[0].Type->isScalar());
return { Layout.ReturnValues[0].Type };
break;
case abi::FunctionType::ReturnMethod::RegisterSet:
return flattenReturnTypes(Layout, Model);
default:
@@ -448,14 +447,14 @@ getExpectedModelType(const llvm::Use *U, const model::Binary &Model) {
auto BitWidth = U->get()->getType()->getIntegerBitWidth();
revng_assert(BitWidth >= 8 and std::has_single_bit(BitWidth));
return { model::PrimitiveType::makeSigned(BitWidth / 8) };
} break;
}
case llvm::Instruction::UDiv:
case llvm::Instruction::URem: {
auto BitWidth = U->get()->getType()->getIntegerBitWidth();
revng_assert(BitWidth >= 8 and std::has_single_bit(BitWidth));
return { model::PrimitiveType::makeUnsigned(BitWidth / 8) };
} break;
}
case llvm::Instruction::AShr:
case llvm::Instruction::LShr:
@@ -494,7 +493,7 @@ getExpectedModelType(const llvm::Use *U, const model::Binary &Model) {
return { model::PrimitiveType::makeNumber(Bytes) };
else
return { model::PrimitiveType::makePointerOrNumber(Bytes) };
} break;
}
case llvm::Instruction::Mul:
case llvm::Instruction::And:
case llvm::Instruction::Or:
@@ -504,7 +503,7 @@ getExpectedModelType(const llvm::Use *U, const model::Binary &Model) {
and (BitWidth == 1 or BitWidth >= 8));
auto Bytes = (BitWidth == 1) ? 1 : BitWidth / 8;
return { model::PrimitiveType::makeNumber(Bytes) };
} break;
}
case llvm::Instruction::FAdd:
case llvm::Instruction::FSub:
case llvm::Instruction::FMul: