<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><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>Thank you,</div><div>Shyan</div></div>