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/GRCXXExprEngine.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/GRCXXExprEngine.cpp')
-rw-r--r-- | lib/Checker/GRCXXExprEngine.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Checker/GRCXXExprEngine.cpp b/lib/Checker/GRCXXExprEngine.cpp index a49989b5fd..0cae455276 100644 --- a/lib/Checker/GRCXXExprEngine.cpp +++ b/lib/Checker/GRCXXExprEngine.cpp @@ -17,9 +17,22 @@ using namespace clang; +namespace { +class CallExprWLItem { +public: + CallExpr::const_arg_iterator I; + ExplodedNode *N; + + CallExprWLItem(const CallExpr::const_arg_iterator &i, ExplodedNode *n) + : I(i), N(n) {} +}; +} + void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE, const FunctionProtoType *FnType, ExplodedNode *Pred, ExplodedNodeSet &Dst) { + + llvm::SmallVector<CallExprWLItem, 20> WorkList; WorkList.reserve(AE - AI); WorkList.push_back(CallExprWLItem(AI, Pred)); @@ -33,10 +46,13 @@ void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE, continue; } + // Evaluate the argument. ExplodedNodeSet Tmp; const unsigned ParamIdx = Item.I - AI; - bool VisitAsLvalue = FnType? FnType->getArgType(ParamIdx)->isReferenceType() - : false; + const bool VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() + ? FnType->getArgType(ParamIdx)->isReferenceType() + : false; + if (VisitAsLvalue) VisitLValue(*Item.I, Item.N, Tmp); else |