<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 3:25 AM Shyan Akmal <<a href="mailto:sakmal@g.hmc.edu">sakmal@g.hmc.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I'm working on a check for fully qualifying names in using declarations. </div><div><br></div><div>When creating an alias for an object outside the file, this just involves prepending the global specifier, so that " using foo::f; " becomes " using ::foo::f; ". </div><div><br></div><div>However, this shouldn't work in general for objects declaring in the existing file. </div><div><br></div><div>For example, for code like</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">namespace example { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">namespace util { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">namespace internal {  </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">enum Color {Red, Green, Blue}; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">}  </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">using internal::Color; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">  </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">} </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">} </blockquote><div><br></div><div>I'd like to replace "internal::Color" with "::example::util::internal::Color" instead of "::internal::Color". </div><div><br></div><div>Given this motivation, I have two questions:</div><div><ol><li>Given a name inside a using declaration, what's the best way to check if that name is declared in the current file?</li></ol></div></div></blockquote><div><br></div><div>Why does that matter? Can't the same happen across files? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><ol><li>Given an object declaration, what is the recommended way of finding it's full nested-name-specifier? (I think getUnderlyingDecl() probably works here)</li></ol></div></div></blockquote><div>I think printQualifiedName on the namedDecl is your best bet; I don't know how getUnderlyingDecl() would help?</div><div><br></div><div>Cheers,</div><div>/Manuel</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div>