<div dir="ltr"><div>Thanks a lot, Alex.</div>I am trying to do that in command line:) how to do that?<div>I meas clang.exe driver:)</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 23, 2016 at 7:39 PM, Alex L <span dir="ltr"><<a href="mailto:arphaman@gmail.com" target="_blank">arphaman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm not sure that I understood your question correctly, but if you are working on auto completion then you can use Preprocessor::<wbr>getMacroDefinition to lookup the definition of a some macro. Specifically, as long as you're working with Sema, you can use code similar to the one below: <div><br></div><div><div> for (const auto &M : PP.macros()) {</div><div> auto MD = PP.getMacroDefinition(M-><wbr>first);</div><div> if (MD) {</div><div> // you have access to macro definition here and can lookup it's source location</div><div> // by using MD.getMacroInfo()-><wbr>getDefinitionLoc()</div><div> }</div><div> }</div></div><div><br></div><div>Alex</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 23 November 2016 at 11:00, 罗勇刚(Yonggang Luo) via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">罗勇刚(Yonggang Luo)</b> <span dir="ltr"><<a href="mailto:luoyonggang@gmail.com" target="_blank">luoyonggang@gmail.com</a>></span><br>Date: Wed, Nov 23, 2016 at 6:58 PM<br>Subject: I am trying to using clang to do autocomplete, How to go to declaration of a macro?<br>To: Clang Dev <<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>><br><br><br><div dir="ltr">For exmaple<div><br></div><div>#define FOO 0</div><div><br></div><div>int foo() {</div><div> int x = FOO; /* How to go to decleration of FOO here? *./</div><div>}<span class="m_8152513015555630136HOEnZb"><font color="#888888"><span class="m_8152513015555630136m_2503497557037564977HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_8152513015555630136m_2503497557037564977m_-8054538153835698066gmail_signature" data-smartmail="gmail_signature"> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo<br></div>
</font></span></font></span></div></div><span class="m_8152513015555630136HOEnZb"><font color="#888888">
</font></span></div><span class="m_8152513015555630136HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_8152513015555630136m_2503497557037564977gmail_signature" data-smartmail="gmail_signature"> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo<br></div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo<br></div>
</div>