================
@@ -3292,149 +3518,125 @@ void ExprEngine::VisitArraySubscriptExpr(const
ArraySubscriptExpr *A,
bool IsGLValueLike = A->isGLValue() ||
(A->getType().isCForbiddenLValueType() && !AMgr.getLangOpts().CPlusPlus);
- for (auto *Node : CheckerPreStmt) {
- const StackFrame *SF = Node->getStackFrame();
- ProgramStateRef state = Node->getState();
-
- if (IsGLValueLike) {
- QualType T = A->getType();
-
- // One of the forbidden LValue types! We still need to have sensible
- // symbolic locations to represent this stuff. Note that arithmetic on
- // void pointers is a GCC extension.
- if (T->isVoidType())
- T = getContext().CharTy;
-
- SVal V = state->getLValue(T, state->getSVal(Idx, SF),
- state->getSVal(Base, SF));
- EvalSet.insert(
- Engine.makeNodeWithBinding(Node, A, V,
ProgramPoint::PostLValueKind));
- } else if (IsVectorType) {
- // FIXME: non-glvalue vector reads are not modelled.
- EvalSet.insert(Engine.makePostStmtNode(A, state, Node));
- } else {
- llvm_unreachable("Array subscript should be an lValue when not \
+ const StackFrame *SF = Pred->getStackFrame();
+ ProgramStateRef state = Pred->getState();
+
+ if (IsGLValueLike) {
+ QualType T = A->getType();
+
+ // One of the forbidden LValue types! We still need to have sensible
+ // symbolic locations to represent this stuff. Note that arithmetic on
+ // void pointers is a GCC extension.
+ if (T->isVoidType())
+ T = getContext().CharTy;
+
+ SVal V =
+ state->getLValue(T, state->getSVal(Idx, SF), state->getSVal(Base, SF));
+ Dst.insert(
+ Engine.makeNodeWithBinding(Pred, A, V, ProgramPoint::PostLValueKind));
+ } else if (IsVectorType) {
+ // FIXME: non-glvalue vector reads are not modelled.
+ Dst.insert(Engine.makePostStmtNode(A, state, Pred));
+ } else {
+ llvm_unreachable("Array subscript should be an lValue when not \
a vector and not a forbidden lvalue type");
- }
}
-
- getCheckerManager().runCheckersForPostStmt(Dst, EvalSet, A, *this);
}
/// VisitMemberExpr - Transfer function for member expressions.
void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
- // FIXME: Prechecks eventually go in ::Visit().
- ExplodedNodeSet CheckedSet;
- getCheckerManager().runCheckersForPreStmt(CheckedSet, Pred, M, *this);
-
- ExplodedNodeSet EvalSet;
ValueDecl *Member = M->getMemberDecl();
// Handle static member variables and enum constants accessed via
// member syntax.
if (isa<VarDecl, EnumConstantDecl>(Member)) {
- for (const auto I : CheckedSet)
- VisitCommonDeclRefExpr(M, Member, I, EvalSet);
+ VisitCommonDeclRefExpr(M, Member, Pred, Dst);
----------------
NagyDonat wrote:
You can do an early `return` here and then you wouldn't need to indent the code
that is currently in the `else` block.
(The old code didn't do an early return, because the `PostStmt` handling was
there at the end of the function, but now you don't need to bother with that.)
https://github.com/llvm/llvm-project/pull/218691
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits