Final AST

Hi,

I’m currently writing a Tool using libtooling & RecursiveAstVisitor.
In the AST I come across quite a lot of Unresolved expressions and I looked through the documentation of UnresolvedMemberExpr [UnresolvedMemberExpr] there it says that those nodes will be resolved in the final AST.
Is there any possibility to get this final AST and run the tool over this? Or to what does this refer?

Thanks for clarification.
Cheers,
Lukas

Hi,

I'm currently writing a Tool using libtooling & RecursiveAstVisitor.
In the AST I come across quite a lot of Unresolved expressions and I
looked through the documentation of UnresolvedMemberExpr
[UnresolvedMemberExpr]<http://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html#details> there
it says that those nodes will be resolved in the final AST.
Is there any possibility to get this final AST and run the tool over this?
Or to what does this refer?

The AST you see with libtooling should be the final AST :slight_smile: Are you running
over incomplete code (that is, code that doesn't compile)?

Can you paste a reproduction?

Thanks,
/Manuel

I've not checked, but I'd assume that there are plenty of unresolved
nodes in parsed templates (as opposed to their instantiations).
Likely the documentation could be improved.

-- James

Sorry for the late answer a simplified extract of the code which gives an UnresolvedMemberExpr is this

class AdapterManager {
public:
using AdapterCreationFunction = void* ()(void adaptee);

template Adapter* someTestFunc();

private:
using TypeIdType = std::size_t;

template
static TypeIdType typeId();

static QHash<TypeIdType, AdapterCreationFunction> defaultAdapters;
};

template AdapterManager::TypeIdType AdapterManager::typeId()
{
return typeid(type).hash_code();
}

template Adapter* AdapterManager::someTestFunc()
{
return defaultAdapters.find( typeId() );
}

in the body of someTestFunc() find is an unresolvedMemberExpr the dump looks like this:

UnresolvedMemberExpr 0x15b2808 ‘’ lvalue

`-DeclRefExpr 0x1583020

‘QHash<TypeIdType, AdapterCreationFunction>’:‘class QHash<unsigned long, void ()(void *)>’ lvalue Var 0x15824f0 ‘defaultAdapters’ ‘QHash<TypeIdType, AdapterCreationFunction>’:‘class QHash<unsigned long, void ()(void *)>’

However if I enter a value instead of the typeId function it is no more unresolved.
So I guess this is normal behavior (because of template stuff) and therefore the description is wrong?