You have to go through the CDOM class to
get an IASTTranslationUnit. The method on ITranslationUnit was an idea that
didn’t get implemented.
From:
cdt-core-dev-bounces@xxxxxxxxxxx [mailto:cdt-core-dev-bounces@xxxxxxxxxxx] On Behalf Of jamsheer pk
Sent: Thursday, January 19, 2006
6:23 AM
To: cdt-core-dev@xxxxxxxxxxx
Subject: [cdt-core-dev] How to get
function call from a c/cpp project through CDT
Thank you for u r reply.
I tried to go through that but even then I am not able to get
IASTTranslationUnit. And can u please explain little bit about how to create a
visitor for tjis. Can I use CollectReferencesAction .
here is the code I am written along with its comment
ICElement[]
sourceRoots = project.getChildren(); // project
is ICProject and contains one c/cpp project
for (int i = 0; i
< sourceRoots.length; i++) {
ISourceRoot root = (ISourceRoot) sourceRoots[i];
ITranslationUnit[] translationUnits =
root.getTranslationUnits(); // here all the source files of the
project
for (int x = 0; x < translationUnits.length; x++) {
ITranslationUnit translationUnit =
translationUnits[x]; // one source file of the project
IASTTranslationUnit asttu =
translationUnit.getASTTranslationUnit(); // it should return root of DOM
but it is not returning
// Here asttu gets only null Root of DOM AST is not getting
}
}
--
"Our Greatest Glory is Not in Never Failing, But in Rising Every Step We
Fall "