[cfe-dev] Questions on Accessing Fully Qualified Names

Shyan Akmal via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 12 18:25:33 PST 2018


Hello,

I'm working on a check for fully qualifying names in using declarations.

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; ".

However, this shouldn't work in general for objects declaring in the
existing file.

For example, for code like

namespace example {

namespace util {



namespace internal {

enum Color {Red, Green, Blue};

}

using internal::Color;



}

}


I'd like to replace "internal::Color" with
"::example::util::internal::Color" instead of "::internal::Color".

Given this motivation, I have two questions:

   1. Given a name inside a using declaration, what's the best way to check
   if that name is declared in the current file?
   2. Given an object declaration, what is the recommended way of finding
   it's full nested-name-specifier? (I think getUnderlyingDecl() probably
   works here)

Thank you,
Shyan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181112/27632daf/attachment.html>


More information about the cfe-dev mailing list