void AdjustedReturnValueChecker::PostVisitCallExpr(CheckerContext &C,
const CallExpr *CE) {
+ // Get the result type of the call.
+ QualType expectedResultTy = CE->getType();
+
// Fetch the signature of the called function.
const GRState *state = C.getState();
SVal V = state->getSVal(CE);
if (V.isUnknown())
return;
+
+ // Casting to void? Discard the value.
+ if (expectedResultTy->isVoidType()) {
+ C.GenerateNode(state->BindExpr(CE, UnknownVal()));
+ return;
+ }
const MemRegion *callee = state->getSVal(CE->getCallee()).getAsRegion();
if (!callee)
if (actualResultTy->getAs<ReferenceType>())
return;
- // Get the result type of the call.
- QualType expectedResultTy = CE->getType();
// Are they the same?
if (expectedResultTy != actualResultTy) {
return 1;
return 0;
}
+
+// Same as previous case, but handle casts to 'void'.
+int bar_rev95274() {
+ void (*Callback_rev95274)(void) = (void (*)(void)) foo_rev95267;
+ (*Callback_rev95274)();
+ return 0;
+}
+