[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Include statements
|
I'm sorry, I haven't explained my problem very well.
I want to check if a particular header is included in my source file. Let's
call it foo.h
If there is #include "foo.h" in my source file, I can detect it in the
processAst(IASTTranslationUnit ast) function via :
for(IASTPreprocessorIncludeStatement inc : ast.getIncludeDirectives()) {
....
}
If there is #include "bar.h" in my source file, and in bar.h there is
#include "foo.h", let's represent it like that :
#include "bar.h"
-->#include "foo.h"
I can detect foo.h from my source file via in my previous loop :
for(IIndexInclude i : inc.getImportedIndexFile().getIncludes()) {
....
}
However, I cannot use that if it goes one rank deeper like that :
#include "bar.h"
-->#include "foobar.h"
-->#include "foo.h"
because there is no equivalent to .getImportedIndexFile().getIncludes() for
IIndexInclude.
I'd like to detect the header no matter how deep it is, but I don't see any
way to do that.
Andrew Eidsness wrote
> Or, where did the IASTTranslationUnit come from? If it is from an IIndex,
> then maybe you can use
> IIndex.getFiles(IIndexFileLocation)?
I can do ast.getIndex().getFiles(location) but how do I get an appropriate
IIndexFileLocation ?
--
View this message in context: http://eclipse.1072660.n5.nabble.com/Include-statements-tp165635p165660.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.