<div><div dir="auto">Like Diana said<font color="#313131"><span style="word-spacing:1px">, overriding </span></font><span style="color:rgb(49,49,49);word-spacing:1px">InclusionDirectiv</span><span style="color:rgb(49,49,49);word-spacing:1px">e will help you getting the include that you want to replace. That method will give you everything you need (location, name, if is an angled include, etc). Since is called in when it finds an include one you TU. </span></div></div><div dir="auto"><span style="color:rgb(49,49,49);word-spacing:1px"><br></span></div><div dir="auto"><span style="color:rgb(49,49,49);word-spacing:1px"><div><a href="https://clang.llvm.org/doxygen/classclang_1_1PPCallbacks.html#ad5509ca394c21faaead91ec8add75dd2">https://clang.llvm.org/doxygen/classclang_1_1PPCallbacks.html#ad5509ca394c21faaead91ec8add75dd2</a></div><div dir="auto"><br></div> Take a look to the details of the InclusionDirective. </span></div><div dir="auto"><span style="color:rgb(49,49,49);word-spacing:1px"><br></span></div><div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, 28 Oct 2019 at 07:23 Diana Picus <<a href="mailto:diana.picus@linaro.org">diana.picus@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, 28 Oct 2019 at 10:28, Kenth Eriksson via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> On Fri, 2019-10-25 at 20:59 -0300, Alberto Lagos wrote:<br>
> > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.<br>
> ><br>
> > Hi Keneth!,<br>
> ><br>
> > Did you try clang::PPCallbacks or clang::PreprocessorFrontEndAction?<br>
> ><br>
> > Probably PPCallbacks is what you are looking for.<br>
> ><br>
> Would it be possible to get the location for the header includes from<br>
> the source manager? E.g. SourceManager::getLocForStartOfFile gives me<br>
> the beginning of the file. But how can I get the location for the<br>
> header files via SM?<br>
<br>
What do you mean by this? Headers can be included anywhere in a file.<br>
Having a big block of include directives close to the top of the file<br>
is just a convention. If you're looking for the include directive for<br>
a specific header (e.g. the one for the old API that you're<br>
replacing), overriding PPCallbacks::InclusionDirective will probably<br>
get you there. Otherwise, you need to think of a way to be more<br>
specific about where you want to include your file (but you should be<br>
very careful because include directives could be part of #if blocks).<br>
<br>
Hope that helps,<br>
Diana<br>
<br>
><br>
> > Let me know if that help!<br>
> ><br>
> > Regards.<br>
> ><br>
> > On Fri, 25 Oct 2019 at 16:13 Kenth Eriksson via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> > > Hi!<br>
> > ><br>
> > > I'm refactoring some code with libtooling, replacing one API call with a new another one. This requires me to insert a new header file. How can this be done?<br>
> > ><br>
> > > Thanks,<br>
> > > Kenth<br>
> > > _______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
> > ><br>
> _______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Enviado con Gmail Mobile</div>