[cfe-dev] Difference between getResultType adn getCallResultType

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Fri Jan 24 02:51:52 PST 2014


 
Hi,

My question is simple. Could anyone explain me what's the difference between the methods
getResultType and getCallResultType in FunctionDecl?

This is the implementation in FunctionType:
02783 [ http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html#aafa453cd7e81a7c3d6c61f261e68afe8 ]   QualType [ http://clang.llvm.org/doxygen/classclang_1_1QualType.html ] getResultType [ http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html#aafa453cd7e81a7c3d6c61f261e68afe8 ]() const { return ResultType; }
...
02799 [ http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html#a5f8df0258bcf7281e7055ea01dbd8f85 ]   QualType [ http://clang.llvm.org/doxygen/classclang_1_1QualType.html ] getCallResultType [ http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html#a5f8df0258bcf7281e7055ea01dbd8f85 ](ASTContext [ http://clang.llvm.org/doxygen/classclang_1_1ASTContext.html ] &Context [ http://clang.llvm.org/doxygen/ASTMatchFinder_8cpp.html#a779280869b9fac47a9bc391e7709171f ]) const {2800     return getResultType().getNonLValueExprType [ http://clang.llvm.org/doxygen/classclang_1_1QualType.html#a89e3ea65c009b7a0ea76edc56076107c ](Context);2801   }
And this is the definition of getNonLValueExprType [ http://clang.llvm.org/doxygen/classclang_1_1QualType.html#a89e3ea65c009b7a0ea76edc56076107c ]:
Determine the type of a (typically non-lvalue) expression with the specified result type. 
This routine should be used for expressions for which the return type is explicitly specified (e.g., in a cast or call) and isn't necessarily an lvalue. It removes a top-level reference (since there are no expressions of reference type) and deletes top-level cvr-qualifiers from non-class types (in C++) or all types (in C). 

But I am not able to understand this very well. Could anyone give me an example of the difference? Up to now, I have been using getResultType, but now I have found getCallResultType and I'm not sure what should I use.

Thanks in advance,

Pedro.


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


More information about the cfe-dev mailing list