Skip to content

Commit e5037ab

Browse files
committed
format
1 parent a5d8e21 commit e5037ab

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -582,34 +582,33 @@ bool handleConstMemberCall(const CallExpr *CE,
582582
State.Env.setStorageLocation(*CE, Loc);
583583
return true;
584584
}
585-
// PRValue cases:
586-
if (CE->getType()->isBooleanType() || CE->getType()->isPointerType()) {
587-
// If the const method returns a boolean or pointer type.
588-
Value *Val = State.Lattice.getOrCreateConstMethodReturnValue(
589-
*RecordLoc, CE, State.Env);
590-
if (Val == nullptr)
591-
return false;
592-
State.Env.setValue(*CE, *Val);
593-
return true;
594-
}
595-
if (isSupportedOptionalType(CE->getType())) {
596-
// If the const method returns an optional by value.
597-
const FunctionDecl *DirectCallee = CE->getDirectCallee();
598-
if (DirectCallee == nullptr)
599-
return false;
600-
StorageLocation &Loc =
601-
State.Lattice.getOrCreateConstMethodReturnStorageLocation(
602-
*RecordLoc, DirectCallee, State.Env, [&](StorageLocation &Loc) {
603-
setHasValue(cast<RecordStorageLocation>(Loc),
604-
State.Env.makeAtomicBoolValue(), State.Env);
605-
});
606-
// Use copyRecord to link the optional to the result object of the call
607-
// expression.
608-
auto &ResultLoc = State.Env.getResultObjectLocation(*CE);
609-
copyRecord(cast<RecordStorageLocation>(Loc), ResultLoc, State.Env);
610-
return true;
611-
}
612-
585+
// PRValue cases:
586+
if (CE->getType()->isBooleanType() || CE->getType()->isPointerType()) {
587+
// If the const method returns a boolean or pointer type.
588+
Value *Val = State.Lattice.getOrCreateConstMethodReturnValue(*RecordLoc, CE,
589+
State.Env);
590+
if (Val == nullptr)
591+
return false;
592+
State.Env.setValue(*CE, *Val);
593+
return true;
594+
}
595+
if (isSupportedOptionalType(CE->getType())) {
596+
// If the const method returns an optional by value.
597+
const FunctionDecl *DirectCallee = CE->getDirectCallee();
598+
if (DirectCallee == nullptr)
599+
return false;
600+
StorageLocation &Loc =
601+
State.Lattice.getOrCreateConstMethodReturnStorageLocation(
602+
*RecordLoc, DirectCallee, State.Env, [&](StorageLocation &Loc) {
603+
setHasValue(cast<RecordStorageLocation>(Loc),
604+
State.Env.makeAtomicBoolValue(), State.Env);
605+
});
606+
// Use copyRecord to link the optional to the result object of the call
607+
// expression.
608+
auto &ResultLoc = State.Env.getResultObjectLocation(*CE);
609+
copyRecord(cast<RecordStorageLocation>(Loc), ResultLoc, State.Env);
610+
return true;
611+
}
613612

614613
return false;
615614
}

0 commit comments

Comments
 (0)