<div dir="ltr"><div><div>So in case of say</div><div><br></div><div>namespace MyNS</div><div>{</div><div> class MyClass {};</div><div>}</div><div><br></div><div>MyNs::MyClass foo();</div><div><br></div><div>You'd like to get the location pointing to MyClass?</div>
<div><br></div><div>TypeLoc TL = FunctionDecl->getTypeSourceInfo()->getTypeLoc();</div><div>FunctionTypeLoc FTL = TL.getAs<FunctionTypeLoc>();</div><div>ElaboratedTypeLoc ETL = FTL.getReturnLoc().getAs<ElaboratedTypeLoc>();</div>
<div>ETL.getNamedTypeLoc().getBeginLoc();<br></div></div><div><br></div><div><br></div><div>Nikola</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 8:26 AM, Daniel Dilts <span dir="ltr"><<a href="mailto:diltsman@gmail.com" target="_blank">diltsman@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">That seems to work for the simple case but not for the case with namespace qualifiers. How would that be modified to handle a qualified name?</div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 3:19 PM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@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">What about getTypeSpecStartLoc? FunctionDecl is derived from a number of classes, the method is likely to be in one of them.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Wed, Jul 2, 2014 at 6:11 AM, Daniel Dilts <span dir="ltr"><<a href="mailto:diltsman@gmail.com" target="_blank">diltsman@gmail.com</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div><div dir="ltr">How do I get a SourceLocation for a FunctionDecl return type? FunctionDecl::getReturnType() returns QualType, and I don't think that I can get source locations from there.</div>
<br></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>