From c7df6d20d24c1c37835f7a2ef14c84e75a3cf2d5 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 18 Oct 2008 04:08:49 +0000 Subject: [PATCH] Function calls and ObjC message expressions can be used in a lvalue context if they return a structure. E.g foo().x == 1. We don't really support, however, such temporaries yet in the environment or the store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57760 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/GRExprEngine.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index ee7141782f..103ec145d4 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -445,7 +445,18 @@ void GRExprEngine::VisitLValue(Expr* Ex, NodeTy* Pred, NodeSet& Dst) { // Note that we have a similar problem for bitfields, since they don't // have "locations" in the sense that we can take their address. Dst.Add(Pred); - return; + 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); + } } -- 2.50.1