Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to map from IASTMacroReferenceName to non-macro node?


while working with AST I found that it not so clear for me how to deal
with IASTMacroReferenceName.
Let's assume we have the following code:

#define NUMBER 10

void func()
  int a = NUMBER + 10;

Let's assume also, I have the offset and length that maps to NUMBER
usage (from index, for example).

I can get the IASTMacroReferenceName as
IASTName name =
astUnit..getNodeSelector(null).findEnclosingName(offset, length);

But how to understand that it is used from func?

The parent of name is IASTMacroExpansion whose parent is IASTTranslationUnit.


Back to the top