In C++ code, a variable can have the same name as a type, e.g. like
int C;
struct C {
static int a;
};
When evaluating an expression like "C::a" by the LLDB parser, clang
will call back into the external source asking for decls for the
identifier "C". Currently, LLDB will only return the decl for the
variable C. This in turn will cause clang to fail with an error.
(This happens for me with the lang/cpp/scope/TestCppScope.py test
case, due to a static variable C in one of the libm.so objects.)
Instead, it seems clang expects the external data source to return
*both* the variable and the type decl. It will then choose the
appropriate one to use based on its current parsing context.
This patch changes ClangExpressionDeclMap::FindExternalVisibleDecls
to always call ClangASTSource::FindExternalVisibleDecls to possibly
identify types, even if we already found a variable of that name.