Mathiasdm/cdt

Build complete AST structure -- find all includes

Opened this issue · 3 comments

Some include statements, such as <stdio.h> cannot be resolved.
Build up knowledge of the AST and the indexer to find out how to resolve these statements.

1: you have an IASTTranslationUnit.
2. IASTTranslationUnit to IIndexFile??? getFilePath! Has StandaloneIndexerInputAdapter
3. IIndex.findIncludes(IIndexFile file) returns an IIndexInclude.
4. IIndexInclude has a method IIndexFileLocation getIncludesLocation()
5. IIndexFileLocation has String getFullPath()
6. TranslationUnitHelper has loadTranslationUnit(String filename)

If you have an IASTTranslationUnit and you want to include it:
ast.getFileLocation().getContextInclusionStatement();

Possible inspiration: AddIncludeOnSelectionAction