[cfe-dev] Proposal: Add a tooling helper to simplify fully qualified names when possible

David Blaikie dblaikie at gmail.com
Wed Nov 14 08:39:41 PST 2012


On Wed, Nov 14, 2012 at 6:01 AM, Daniel Cheng <dcheng at google.com> wrote:
> I recently wrote a small tool to do some automated refactoring. During
> that work, I ended up writing some helper functions to "simplify"
> fully qualified names, i.e. if you're already in namespace a::b, you
> can refer to a::b::C as "C" rather than using the fully qualified
> name. I'm wondering if there'd be interest in upstreaming this
> functionality into Clang, as I believe this would be a generally
> useful utility.
>
> Currently, I have the following signature:
>
> // Attempts to find the most concise way to refer to 'symbol' in the given
> // context. 'symbol' should be a fully qualified name.
> string SimplifySymbol(
>     const clang::ASTContext& ast_context,
>     const clang::DeclContext* context,
>     const string& symbol);  // I think this should probably be a
> NamedDecl* to prevent ambiguities
>
> Do other people feel this sort of thing would be helpful, and if so,
> where would it belong? It seems like it ought to be a member of
> NamedDecl or DeclContext, but I'm new to Clang development, so I'm
> interested in feedback and comments. Thanks!

I haven't looked closely but would this be applicable to Clang's typo
correction logic & improve the quality of the typo correction by
offering minimally qualified names?

If that's the case that might be a good angle of attack to get this
upstream with a solid use case.



More information about the cfe-dev mailing list