[cfe-dev] MemberExpr::getMemberDecl()

Ted Kremenek kremenek at apple.com
Wed Mar 18 08:17:03 PDT 2009


On Mar 18, 2009, at 8:13 AM, Douglas Gregor wrote:

>
> On Mar 18, 2009, at 3:36 AM, Martin Doucha wrote:
>
>> Hi,
>> why did the return type of MemberExpr::getMemberDecl() change from
>> FieldDecl (which has QualType data) to NamedDecl (which doesn't)? I
>> was
>> using the type information from FieldDecl for some semantic checks.
>
> In C++, a  MemberExpr can also refer to a method (CXXMethodDecl). In
> C, it will always be a FieldDecl.

We should probably add this information as a comment to  
getMemberDecl().  Right now the documentation for MemberExpr is fairly  
spartan.  Better yet, it would be nice if getMemberDecl() returned a  
"variant" that was either CXXMethodDecl* or FieldDecl*, making this  
explicit in the type system.



More information about the cfe-dev mailing list