How Variables and QualTypes work?

Dear Clang Developers:

I’m trying to understand how QualType and Variable references work in the system. Basically, I want to make some changes to the way that ActOnBinOp works depending on the types of the LHSExpr and the RHSExpr values. In particular, I want to detect when one of these expressions has a qualifier that I’ve added called “Block Size” on the type. I’ve basically implemented it following the Address Space pattern, and I have verified that the type information does get added to some node at the handling of type attributes. However, the node that I get in the LHS of ActOnBinOp doesn’t have the expected type information. Here’s a small example:

int global(8) *p = …;
p = p + 1;

In this case, I am dealing with “p + 1” and I expect the node representing “p” (LHSExpr) to be annotated with my new type attribute information. However, the node doesn’t have this. I dumped the AST and noticed that there is an ImplicitCast node wrapping an internal node. I suspect, but have not verified, that the type information is in the contained node, but that, for some reason, this type information isn’t being pushed up to the implicitcast. At this point, I’m running into my ignorance of how Clang does it’s AST parsing and handling, so I’m not sure of the correct way to deal with this to ensure that such expressions have the type information I want on them.

I would appreciate suggestions on how to properly move forward on this.

Of course I might have sent this too soon. I see that what I’m actually dealing with is a DeclRefExpr node and not an ImplicitCast node. I’m not sure how to get the appropriate type information that I want from such a node.