Currently evaluating an expression involving a global variable inside
an inline namespace will fail to lookup said variable. This is because
the SymbolFileDWARF::FindGlobalVariables discards from consideration
all DIEs whose decl_context doesn't exactly match that of the lookup.
This patch relaxes this restriction by checking whether C++ rules
would permit the lookup.
The motivation for this is evaluating std::ranges expressions, which
heavily rely on global variables inside inline namespaces. E.g.,
std::views::all(...) is just an invocation of the operator()
on std::ranges::views::__cpo::all.
Testing
- Added API tests
From the textual description above it sounds like this is a C++ specific feature, but the change is in generic code. Is IsContainedInLookup() implemented in a language-specific way?