[cfe-commits] [PATCH] Expressions have lvalues and rvalues

Ted Kremenek kremenek at apple.com
Wed Oct 15 00:39:42 PDT 2008


On Oct 9, 2008, at 6:45 AM, Zhongxing Xu wrote:

> So I suggest when we evaluate expressions, we pass on an argument  
> indicating
> whether we want to get its lvalue/rvalue, instead of specifying we  
> are getting a
> LVal or NonLVal.

For casts:

+void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred,  
NodeSet& Dst,
+                             bool asLValue) {

    NodeSet S1;
    QualType T = CastE->getType();

-  if (T->isReferenceType())
-    VisitLVal(Ex, Pred, S1);
+  if (asLValue || T->isReferenceType())
+    VisitLValue(Ex, Pred, S1);
    else
      Visit(Ex, Pred, S1);

Is there a case where a cast should evaluate to an lvalue?  I don't  
see VisitCast called with "asLValue" being true.



More information about the cfe-commits mailing list