[cfe-dev] Function return type from ReturnStmt

Phil King phil_king at rocketmail.com
Fri Mar 23 15:15:43 PDT 2012


Of course, that makes sense. The top-most type will always be the same as the return type. (Bangs head on desk !).

Looking through the implicit cast does then allow me to check for 'undesirable' type conversions.

Thanks, I knew it would be easy ;-) Phil.



________________________________
 From: John McCall <rjmccall at apple.com>
To: Phil King <phil_king at rocketmail.com> 
Cc: Clang dev mailing list <cfe-dev at cs.uiuc.edu> 
Sent: Friday, 23 March 2012, 18:09
Subject: Re: [cfe-dev] Function return type from ReturnStmt
 

On Mar 23, 2012, at 1:49 AM, Phil King wrote:
I'm trying to get the return type for the function associated with a ReturnStmt AST node.
>
>
>The type of the return expression is easy as that's available via getRetValue(), but I can't see an obvious way to get the return type of the function (so I can check the two match).
The expression in the ReturnStmt will have been implicitly converted to the return type, so unless you're writing an AST verifier, there is nothing to do here.

You probably want to look past any implicit conversions and see what expression was actually written.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120323/c1df1736/attachment.html>


More information about the cfe-dev mailing list