[cfe-dev] Proposal: Add a tooling helper to simplify fully qualified names when possible
klimek at google.com
Wed Nov 14 14:32:56 PST 2012
I just chatted with Richard, and he suggested adding it to ASTContext would
be a good fit.
On Wed, Nov 14, 2012 at 9:23 AM, Jordan Rose <jordan_rose at apple.com> wrote:
> On Nov 14, 2012, at 8:39 , David Blaikie <dblaikie at gmail.com> wrote:
> > 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
> >> // 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.
> I also haven't looked closely, but another good use case is code
> completion, where I'd rather have "IfStmt" than "clang::IfStmt". (I think
> we get this one right already, but there are other examples that we don't.)
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev