Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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 "

Back to the top