Page MenuHomePhabricator

Add scope tree for variable searching
AbandonedPublic

Authored by paulherman on Aug 24 2015, 5:06 PM.

Details

Summary

The idea is to structure the scopes as a tree. A scope is either a lexical block, a function or a compile unit. Each scope is a node in the tree and is represented by the class VariableType. It has a list of variables declared in it and a list of imported variables (for example by importing a namespace). To search for a variable when evaluating an expression we go up through the tree starting from the node representing the current lexical block until we either find a variable or we encounter a NULL node (the parent of a CU is NULL).

The imported variables for each scope are parsed when the variables for the scope is parsed. This is done by the ParseNamespace method in SymbolFileDWARF which is called by ParseVariablesForContext for the compile unit and by ParseVariables for the other scopes. A special case is anonymous namespaces which should be imported to the compile unit.

Diff Detail

Event Timeline

paulherman updated this revision to Diff 33025.Aug 24 2015, 5:06 PM
paulherman retitled this revision from to Add scope tree for variable searching.
paulherman updated this object.
chaoren removed a reviewer: sivachandra.
chaoren added a reviewer: sivachandra.
paulherman updated this object.Aug 24 2015, 5:47 PM

Add scope tree for variable searching

paulherman updated this object.Aug 25 2015, 12:29 PM
paulherman updated this revision to Diff 33139.Aug 25 2015, 3:49 PM

Add scope tree for variable searching

paulherman updated this revision to Diff 33152.Aug 25 2015, 4:22 PM

Add scope tree for variable searching

Add scope tree for variable searching

paulherman updated this revision to Diff 33279.Aug 26 2015, 4:58 PM

Add scope tree for variable searching

paulherman added a subscriber: lldb-commits.

Add scope tree for variable searching

clayborg requested changes to this revision.Aug 27 2015, 1:39 PM
clayborg edited edge metadata.

This seems to be very variable specific.

I would like to see if be able to ask a lldb_private::Block or a lldb_private::Compile and to provide a list of CompilerDeclContext objects that can be then searched by the expression parser in FindExternalVisibleDecls by searching these decl contexts starting with the block and each block's parent and then checking the compile unit. Then we don't need any variable trees as we can currently request thing (functions, globals, and other things) that have a specific CompilerDeclContext as their parents.

Basically if we implement this, I would rather not see it just be for variables. I want functions, variables, and more to work as expected.

This revision now requires changes to proceed.Aug 27 2015, 1:39 PM
paulherman abandoned this revision.Sep 16 2015, 2:32 PM