Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Finding all ITranslationUnits

Is there a better way to do this? I want to look at every AST node but
I need to first get all the ITranslationUnits which seems to be adhoc
and messy.  Can you implement a project.getAllITranslationUnits() ?

-J

-------------------------------------------
List<ITranslationUnit> toSearch = new ArrayList<ITranslationUnit>();

for (ISourceRoot root : project.getSourceRoots()){
	
  // If there are files directly in the root
  for(ITranslationUnit tu : root.getTranslationUnits())
    toSearch.add(tu);
	
  // If we have source roots such as "Debug" or "src"
  for(ICContainer ic : root.getCContainers())
    for(ITranslationUnit tu : ic.getTranslationUnits())
      toSearch.add(tu);
}
---------------------------------------------


Back to the top