[cfe-commits] r57761 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp

Zhongxing Xu xuzhongxing at gmail.com
Sat Oct 18 04:46:19 PDT 2008


On Sat, Oct 18, 2008 at 12:15 PM, Ted Kremenek <kremenek at apple.com> wrote:

> Author: kremenek
> Date: Fri Oct 17 23:15:35 2008
> New Revision: 57761
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57761&view=rev
> Log:
> Generalize VisitLValue: not only can CallExprs and ObjCMessageExprs return
> aggregate temporaries, so can many other expressions.
>
> Modified:
>    cfe/trunk/lib/Analysis/GRExprEngine.cpp
>
> Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=57761&r1=57760&r2=57761&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
> +++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Fri Oct 17 23:15:35 2008
> @@ -408,9 +408,6 @@
>   }
>
>   switch (Ex->getStmtClass()) {
> -    default:
> -      Ex->dump();
> -      assert(0 && "Other kinds of expressions do not have lvalue.");
>
>     case Stmt::ArraySubscriptExprClass:
>       VisitArraySubscriptExpr(cast<ArraySubscriptExpr>(Ex), Pred, Dst,
> true);
> @@ -447,16 +444,16 @@
>       Dst.Add(Pred);
>       return;
>
> -    case Stmt::CallExprClass:
> -    case Stmt::ObjCMessageExprClass:
> -      // Function calls and message expressions that return temporaries
> -      // that are objects can be called in this context.  We need to
> -      // enhance our support of struct return values, so right now just
> -      // do a regular visit.
> -      assert (!Ex->getType()->isIntegerType());
> -      assert (!Ex->getType()->isPointerType());
> -      Visit(Ex, Pred, Dst);
> +    default:
> +      // Arbitrary subexpressions can return aggregate temporaries that
> +      // can be used in a lvalue context.  We need to enhance our support
> +      // of such temporaries in both the environment and the store, so
> right

Yes. Such enhancement is also necessary for struct assignment:
struct s {};
struct s d1;
d1 = foo();

We might need to extend SVal to represent aggregate value.

Also, temporaries are prevalent in C++.


>
> +      // now we just do a regular visit.
> +      assert (Ex->getType()->isAggregateType() &&
> +              "Other kinds of expressions with non-aggregate types do not
> "
> +              "have lvalues.");
>
> +      Visit(Ex, Pred, Dst);
>   }
>  }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081018/d8d3dcf8/attachment.html>


More information about the cfe-commits mailing list