[cfe-dev] clang-tidy: Tool for removing "this->" from source code?
richard at metafoo.co.uk
Tue Jun 9 13:31:40 PDT 2015
On Tue, Jun 9, 2015 at 3:52 AM, Manuel Klimek <klimek at google.com> wrote:
> Yea, this is really hard currently in clang's design: the only place at
> which the lookup information is available is during semantic analysis on
> clang's stack :(
> This has been one of the most requested features though, so perhaps we can
> find a way to allow re-querying some flows of sema (or being able to
> optionally store some info) for this.
> cc'ing Richard for ideas.
It seems relatively straightforward to walk the AST and rebuild the Scope
information that Sema would need to perform an unqualified name lookup from
a specified context. A starting point of a clang::Expr is not sufficient,
however, because that doesn't identify a unique place in the AST; we'd need
to know the path taken to get there. (I'd imagine your AST visitor could
easily accumulate this information when it's looking for places to
> On Tue, Jun 9, 2015 at 10:05 AM Kevin Funk <kfunk at kde.org> wrote:
>> On Tuesday 09 June 2015 06:27:02 Wilhelm wrote:
>> > (snip)
>> > Am 08.06.2015 um 13:54 schrieb Kevin Funk:
>> > (snip)
>> > > Now the part I'm struggling with is how to make sure the "member name"
>> > > is a non-ambiguous identifier from the current context so I can just
>> > > strip "this->". How can I find out the accessible declarations (or
>> > > the ids) from the context of the expression referencing `this`? I'm
>> > > missing API to get the clang::DeclContext, plus looking up
>> > > accessible from within this context.
>> I didn't get a lot of replies to my actual question, so let's maybe
>> it a bit.
>> My root problem:
>> Given an instance of clang::Expr: how can I deduce the context of this
>> expression and get a list of declarations which are accessible from this
>> context. What API can I use for this?
>> This sounds trivial, but I didn't figure it out yet. Apparently I'm
>> something obvious here.
>> Kevin Funk | kfunk at kde.org | http://kfunk.org
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev