<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false">This message is a request to libClang developers. I'm not sure this is the right mailing list to ask.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I'm using libClang API (simple C), not libTooling (C++).<br></div><div dir="ltr" data-setdir="false">I'd like to get the cursor spelling of unary and binary operators correctly.</div><div dir="ltr" data-setdir="false">Because clang_getCursorSpelling returns an empty string, I have implemented functions that get the source range of the operator (only the operator, not the operands), and get the token in the source range.</div><div dir="ltr" data-setdir="false">The problem comes when the expresion involving the operators is inside a macro: the functions return the macro name.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Example:</div><div dir="ltr" data-setdir="false">#define MACRO1(a,b,v,c) case a: v = b*c; break;</div><div dir="ltr" data-setdir="false">static void function(int a)</div><div dir="ltr" data-setdir="false">{</div><div dir="ltr" data-setdir="false">    int b;</div><div dir="ltr" data-setdir="false">    switch(a)</div><div dir="ltr" data-setdir="false">    {</div><div dir="ltr" data-setdir="false">        MACRO1(1, 7, b, 6);</div><div dir="ltr" data-setdir="false">        case 2: b = 3*4; break;</div><div dir="ltr" data-setdir="false">    }</div><div dir="ltr" data-setdir="false">}</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Dear libClang developer, can you make that <span>function clang_getCursorSpelling return</span>s the spelling of operators?</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div></div></body></html>