This adds the ability to lookup variables to the DWARF v5 index class.
find-basic-variable.cpp test is extended to cover this scenario as well,
and I have added a new test which verifies that the dwarf v5 index class
is indeed used.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | ||
---|---|---|
70 ↗ | (On Diff #149967) | Hmm... thanks for pointing this out. There is some index-independent filtering based on CompilerDeclContexts happening in SymbolFileDWARF (which is why my context test actually passes here). I was basing this off of how apple and manual indexes work, and neither of them check the context. In fact, the manual index does not even extract the identifier portion of the name (it just looks up the whole string), so maybe nobody passes qualified names names into this function anyway? I am starting to think I should just remove the ExtractContextAndIdentifier call. If we see failures down the line, at least we will learn why was this call there in the first place. |
Feel free to check into it and modify the contract for GetGlobalVariables and possibly rename "name" to "basename" to be clear what the argument is. Then modify the headerdoc to clearly state what we are looking for if the filtering is going on higher up
Ok, so it turns out we were passing qualified names into the
GetGlobalVariables function. In the apple-tables case we were then searching
based on the basename and completely ignoring the context. This resulted in
incorrect matches being returned (I believe this is the bug Jonas is
investigating right now). In the manual-index case, we weren't doing the search
based on the basename, but things worked because our index also contained
demangled names.
This version of the patch does the following:
- remove context handling from the index classes. The GetGlobalVariables function now takes a basename like you suggested.
- in particular, this means that the manual index can now stop storing demangled names of global variables. This makes it consistent with the other indexes and with the function case, where we removed demangled names a couple of weeks ago.
- puts the context extraction into SymbolFileDWARF, so that it is available to all indexes.
- implements context filtering ("fixing" Jonas's bug), also in SymbolFileDWARF. I am not particularly proud of how this is implemented (substring search), but this is the same way that function context pruning is done (cf. Module::LookupInfo::Prune). A more sensible framework for context handling would be in order, but I consider that out of scope for this patch.
Much better. Anything we can do to clearly define and simplify the indexers is great stuff.