-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Based on a discussion with @dbartol, we talked about altering the structure of the Print AST query for C++ so that the structure more closely aligns with the underlying AST.
One example is with type casts. Here is a screenshot from the AST Viewer in VSCode.
Notice that the implication of this tree snippet is that the CStyleCast is a child of the AssignExpr, but in reality, the AssignExpr has two children, both are VariableAcceses. The cast node is off to the side and not directly part of the tree structure. In this case, the Print AST query should remove the CStyleCast from the main tree and ensure the AssignExpr's second AST child is the other VariableAccess.
It would still be useful to include this cast in the tree somehow, perhaps as metadata on the VariableAccess, and this information can be displayed in the tree in a different way.
The goal is to provide the most useful information for new users of Code QL. The implication from the tree is that assignExpr.getRValue() instanceof CStyleCast, but it is not.
There may be more examples of this in the C++ AST. This is the first one I came across.


