diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-09-23 05:14:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-09-23 05:14:51 +0000 |
commit | c69c43845aa3ede95af837b8be52868eca55d64d (patch) | |
tree | 3609a91081b4fcae0939dbf851c4c1fb3a4b8b96 /lib/Checker/GRExprEngine.cpp | |
parent | 7bb1d23213165f9260f67440ee83b8d7dbc591f7 (diff) |
Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/GRExprEngine.cpp')
-rw-r--r-- | lib/Checker/GRExprEngine.cpp | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index 35f043f5cd..9c1eef23b5 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -2078,41 +2078,9 @@ void GRExprEngine::VisitCall(const CallExpr* CE, ExplodedNode* Pred, if (const PointerType *FnTypePtr = FnType->getAs<PointerType>()) Proto = FnTypePtr->getPointeeType()->getAs<FunctionProtoType>(); - // Create a worklist to process the arguments. - llvm::SmallVector<CallExprWLItem, 20> WorkList; - WorkList.reserve(AE - AI); - WorkList.push_back(CallExprWLItem(AI, Pred)); - + // Evaluate the arguments. ExplodedNodeSet ArgsEvaluated; - - while (!WorkList.empty()) { - CallExprWLItem Item = WorkList.back(); - WorkList.pop_back(); - - if (Item.I == AE) { - ArgsEvaluated.insert(Item.N); - continue; - } - - // Evaluate the argument. - ExplodedNodeSet Tmp; - const unsigned ParamIdx = Item.I - AI; - - bool VisitAsLvalue = false; - if (Proto && ParamIdx < Proto->getNumArgs()) - VisitAsLvalue = Proto->getArgType(ParamIdx)->isReferenceType(); - - if (VisitAsLvalue) - VisitLValue(*Item.I, Item.N, Tmp); - else - Visit(*Item.I, Item.N, Tmp); - - // Enqueue evaluating the next argument on the worklist. - ++(Item.I); - - for (ExplodedNodeSet::iterator NI=Tmp.begin(), NE=Tmp.end(); NI!=NE; ++NI) - WorkList.push_back(CallExprWLItem(Item.I, *NI)); - } + EvalArguments(CE->arg_begin(), CE->arg_end(), Proto, Pred, ArgsEvaluated); // Now process the call itself. ExplodedNodeSet DstTmp; @@ -2131,7 +2099,6 @@ void GRExprEngine::VisitCall(const CallExpr* CE, ExplodedNode* Pred, // to see if the can evaluate the function call. ExplodedNodeSet DstTmp3; - for (ExplodedNodeSet::iterator DI = DstTmp.begin(), DE = DstTmp.end(); DI != DE; ++DI) { |