[cfe-commits] [PATCH] GRExprEngine operator method first argument as lvalue

Zhongxing Xu xuzhongxing at gmail.com
Wed Nov 17 00:17:50 PST 2010


Index: lib/Checker/GRExprEngine.cpp
===================================================================
--- lib/Checker/GRExprEngine.cpp    (revision 119383)
+++ lib/Checker/GRExprEngine.cpp    (working copy)
@@ -2061,9 +2061,11 @@
   if (const PointerType *FnTypePtr = FnType->getAs<PointerType>())
     Proto = FnTypePtr->getPointeeType()->getAs<FunctionProtoType>();

-  // Evaluate the arguments.
+  // Evaluate the arguments. For a method call treat the first argument
+  // as a lvalue.
   ExplodedNodeSet ArgsEvaluated;
-  EvalArguments(CE->arg_begin(), CE->arg_end(), Proto, Pred,
ArgsEvaluated);
+  EvalArguments(CE->arg_begin(), CE->arg_end(), Proto, Pred, ArgsEvaluated,
+      dyn_cast_or_null<CXXMethodDecl>(CE->getCalleeDecl()));

This part is not necessary, since CXXOperatorCallExpr would be visited in
its own method.

Other parts of the patch are good to apply.

2010/11/17 Marcin Świderski <marcin.sfider at gmail.com>

> W dniu 17 listopada 2010 04:33 użytkownik Zhongxing Xu <
> xuzhongxing at gmail.com> napisał:
>
> I guess we shouldn't handle CXXOperatorCallExpr in VisitCall(). It should
>> has it own code path, like CXXMemberCallExpr.
>>
>> 2010/11/17 Marcin Świderski <marcin.sfider at gmail.com>
>>
>>> Patch: For an operator call that really is a method call treat the first
>>> argument as a lvalue.
>>>
>>> Please approve for commit.
>>>
>>> - Marcin
>>>
>>
>> Yes, I forgot to mention that it's for CXXOperatorCallExpr, will add this
> in comment. It probably should have its own code path, but the new
> FstArgAsLValue argument of EvalArguments will be usable for it, so this
> change can be treated as the first step in proper handling of
> CXXOperatorCallExpr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101117/e518406c/attachment.html>


More information about the cfe-commits mailing list