From: Marcin Swiderski Date: Wed, 17 Nov 2010 21:27:36 +0000 (+0000) Subject: In EvalArguments allow for evaluation of first argument always as a lvalue. Will... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82c63bfa0c5130e0cf274c1974b6157ebefc04fe;p=clang In EvalArguments allow for evaluation of first argument always as a lvalue. Will be used for CXXOperatorCallExpr that represents method call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119567 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Checker/PathSensitive/GRExprEngine.h b/include/clang/Checker/PathSensitive/GRExprEngine.h index f9082f4214..998eceffc3 100644 --- a/include/clang/Checker/PathSensitive/GRExprEngine.h +++ b/include/clang/Checker/PathSensitive/GRExprEngine.h @@ -451,7 +451,8 @@ public: /// Evaluate arguments with a work list algorithm. void EvalArguments(ConstExprIterator AI, ConstExprIterator AE, const FunctionProtoType *FnType, - ExplodedNode *Pred, ExplodedNodeSet &Dst); + ExplodedNode *Pred, ExplodedNodeSet &Dst, + bool FstArgAsLValue = false); /// EvalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic /// expressions of the form 'x != 0' and generate new nodes (stored in Dst) diff --git a/lib/Checker/GRCXXExprEngine.cpp b/lib/Checker/GRCXXExprEngine.cpp index 50f2cb51c0..4c996bb22e 100644 --- a/lib/Checker/GRCXXExprEngine.cpp +++ b/lib/Checker/GRCXXExprEngine.cpp @@ -30,7 +30,8 @@ public: void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE, const FunctionProtoType *FnType, - ExplodedNode *Pred, ExplodedNodeSet &Dst) { + ExplodedNode *Pred, ExplodedNodeSet &Dst, + bool FstArgAsLValue) { llvm::SmallVector WorkList; @@ -48,10 +49,15 @@ void GRExprEngine::EvalArguments(ConstExprIterator AI, ConstExprIterator AE, // Evaluate the argument. ExplodedNodeSet Tmp; - const unsigned ParamIdx = Item.I - AI; - const bool VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() - ? FnType->getArgType(ParamIdx)->isReferenceType() - : false; + bool VisitAsLvalue = FstArgAsLValue; + if (FstArgAsLValue) { + FstArgAsLValue = false; + } else { + const unsigned ParamIdx = Item.I - AI; + VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() + ? FnType->getArgType(ParamIdx)->isReferenceType() + : false; + } if (VisitAsLvalue) VisitLValue(*Item.I, Item.N, Tmp);