Problem obtaining the SourceRange of a BinaryOperator

Hello,

I have a problem when trying to obtain the SourceRange of a BinaryOperator which RHS is a null pointer. Having something like “x = Null;”, being x a pointer type variable, i can get the location of everything but the “Null”, it seems like it doesn’t exists. If I print the ast, the part referred to this is:

`-BinaryOperator 0xc750768 <line:7:5, /usr/local/bin/…/lib/clang/3.4/include/stddef.h:72:18> ‘char *’ lvalue ‘=’

-MemberExpr 0xc750728 prueba.cpp:7:5 ‘char *’ lvalue ->x 0xc7505b0
-CXXThisExpr 0xc750718 <col:5> 'class X *' this -ImplicitCastExpr 0xc750758 </usr/local/bin/…/lib/clang/3.4/include/stddef.h:72:18> ‘char *’
`-GNUNullExpr 0xc750748 col:18 ‘int’

But i don’t see it clearly. Can someone help me with this?

Thank you.

Hello,

I have a problem when trying to obtain the SourceRange of a BinaryOperator
which RHS is a null pointer. Having something like "x = Null;", being x a
pointer type variable, i can get the location of everything but the "Null",
it seems like it doesn't exists. If I print the ast, the part referred to
this is:

`-BinaryOperator 0xc750768 <line:7:5,
/usr/local/bin/../lib/clang/3.4/include/stddef.h:72:18> 'char *' lvalue '='
> > >-MemberExpr 0xc750728 <prueba.cpp:7:5> 'char *' lvalue ->x
0xc7505b0
> > > `-CXXThisExpr 0xc750718 <col:5> 'class X *' this
> > `-ImplicitCastExpr 0xc750758
</usr/local/bin/../lib/clang/3.4/include/stddef.h:72:18> 'char *'
<NullToPointer>
> > `-GNUNullExpr 0xc750748 <col:18> 'int'

But i don't see it clearly. Can someone help me with this?

I assume your problem is that Null is a macro in your code... So you'll
have to drill through the expansion / spelling locations to get to the
right point.