Skip to content

Commit

Permalink
Permit mixed record/namespace search to depth 5
Browse files Browse the repository at this point in the history
Summary:
Due to lack of recursion, we unroll the branches of the cxx1.Scope term as cases in Angle.

The pure namespace case is just a flat list, so its fairly easy to handle (e.g. a symbol under a lot of namespaces).  We allow these to length 7 (i.e. a search term of length 8, where the prefix is 7 namespaces).

For recordWithAccess, there are two inner terms, either the record's parent is a namespace or another record. The various combinations of these lead to some bloat so we only tried to depth 4.

This patch adds depth 5, where the prefix at position 5 must be a namespace.

`NS::(Rec|NS)::(Rec|NS)::(Rec|NS)::(Rec|NS)::Sym`

will work.

## how to solve it long term

I think to do this well we need to reindex the type Scope in cxx.angle to be a flat, addressable structure indexed by suffix. Then arbitrary dotted scope terms would work. This would require enumeratnig terms and flattening them (effectivley recursion at deriving time to flatten things)

OR

we get proper recursion and can express this as a query either in a derived predicate or a query.

Reviewed By: josefs

Differential Revision: D68193102

fbshipit-source-id: 33c40b4170100cb5ba31b013abc4e0bcc0715f31
  • Loading branch information
donsbot authored and facebook-github-bot committed Jan 15, 2025
1 parent d8b11e3 commit df3d572
Show file tree
Hide file tree
Showing 79 changed files with 20,151 additions and 2,658 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"@generated": null,
"facts_searched": {
"cxx1.FunctionDeclaration.5": 7,
"cxx1.RecordDeclaration.5": 18,
"cxx1.RecordDefinition.5": 10
"cxx1.FunctionDeclaration.5": 9,
"cxx1.RecordDeclaration.5": 28,
"cxx1.RecordDefinition.5": 15
},
"full_scans": [ "cxx1.FunctionDeclaration.5", "cxx1.RecordDeclaration.5" ]
}
Loading

0 comments on commit df3d572

Please sign in to comment.