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

Zhongxing Xu xuzhongxing at gmail.com
Thu Oct 16 18:19:11 PDT 2008


On Fri, Oct 17, 2008 at 8:55 AM, Ted Kremenek <kremenek at apple.com> wrote:

> Author: kremenek
> Date: Thu Oct 16 19:55:33 2008
> New Revision: 57659
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57659&view=rev
> Log:
> Remove an untrue assertion: lval::FuncVals can be returned in both rvalue
> and lvalue contexts.


True. In the following case we'll take g's lvalue in the first assignment,
then g's rvalue with an implicitcast from function type to pointer to
function type. Since we represent both as lval::FuncVals, no conversion is
required for the cast.
VisitCast() faithfully does this.

void g() {
}

void f() {
  void (*p)();
  p = &g;
  p == g;
}


>
> 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=57659&r1=57658&r2=57659&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
> +++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Thu Oct 16 19:55:33 2008
> @@ -834,8 +834,10 @@
>     return;
>
>   } else if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) {
> -    assert(!asLValue && "FunctionDecl does not have lvalue.");
> -
> +    // We return the lval::FuncVal for an FunctionDecl in both rvalue
> +    // and lvalue contexts.
> +    // FIXME: Does this need to be revised?  We were getting cases in
> +    //  real code that did this.
>     RVal V = lval::FuncVal(FD);
>     MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V));
>     return;
>
>
> _______________________________________________
> 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/20081017/2f24a6e1/attachment.html>


More information about the cfe-commits mailing list