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.


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
<>  , but
it seems a little outdated and isn't very user-friendly.

Regards, Hadrien Bertrand

View this message in context:
Sent from the Eclipse CDT - Development mailing list archive at
cdt-dev mailing list

Back to the top