Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Include statements

Hi Hadrien

Use the following to get an index-file from a path:

String path = ...
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
ITranslationUnit tu = CoreModelUtil.findTranslationUnit(file);
IIndexFileLocation fileLocation = IndexLocationFactory.getIFL(tu);
IIndexFile[] files = ast.getIndex().getFiles(fileLocation);
for (IIndexFile curFile : files) {
  try {
    if (curFile.getLinkageID() == ast.getLinkage().getLinkageID()) {
      return curFile;
    }
  } catch (CoreException e) {
    //log exception
  }
}

I'm not sure if there is a helper somewhere doing that because this is way to complicated. But this should work at least.

Cheers
Lukas


On 18.02.2014 16:42, Hadrien Bertrand wrote:
Thanks for the quick reply !

Yes, ast is an instance of IASTranslationUnit.

How can I obtain/create the IIndexFile I want ? I only have the name of the
header I want to check.

By the way, is there an official documentation on Codan ? I don't find much
by browsing on the internet. Currently I am using this
https://www.cct.lsu.edu/~rguidry/eclipse-doc36/overview-frame.html
<https://www.cct.lsu.edu/~rguidry/eclipse-doc36/overview-frame.html>  , but
it seems a little outdated and isn't very user-friendly.

Regards, Hadrien Bertrand



--
View this message in context: http://eclipse.1072660.n5.nabble.com/Include-statements-tp165635p165641.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top