Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] getRawSignature does not work with certain IASTNodes

Never mind. I figured it out. I was using the copy() function after the parse and that was removing the translation unit.

Thanks a lot. Helps now.



On Mon, Dec 7, 2015 at 10:17 PM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:
I am constructing  an IASTTranslationUnit from a parse function and all the nodes in consideration are part of this translation unit. Is there somethng I am missing.

And is there any other way to bypass this and print the IASTNode itself? It feels like this should be possible and permitted as its a simple operation.



On Mon, Dec 7, 2015 at 10:01 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
> I am unable to get the string representation of certain IASTNodes using
> getRawSignature. Are there special ways to do this. Also, the
> Node.getTranslationUnit() returns a null in these cases.

getTranslationUnit() is implemented by walking up the "parent" pointers
from the IASTNode until you reach the translation unit. If this is returning
null, that means the node is not hooked up into an AST properly.

As the node does not store its own string representation, only the
translation unit does (and the node stores an offset/length into that),
having the translation unit is necessary to get the string rep of the node.

Regards,
Nate


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top