Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] different inclusion kinds in SingleProject vs. ProjectWithDepProj

Index tests such as IndexCPPBindingResolutionTest are run in two
flavours: SingleProject, and ProjectWithDepProj.

In SingleProject, the header file and the source file are both
placed into the same project; in ProjectWithDepProj, the header
file is placed into one project, and the source file into a second
project which references the first.

While debugging an index test, I noticed a difference between the
two flavours that I did not expect.

When indexing the source file, when the parser processes the
inclusion of the header file, the inclusion kind is different
between the two flavours.

For SingleProject, the inclusion kind is InclusionKind.FOUND_IN_INDEX.
This is what I would expect.

For ProjectWithDepProject, however, the inclusion kind is
InclusionKind.USE_SOURCE. The reason is that, even though
CPreprocessor.fFileContentProvider is an IndexBasedFileContentProvider,
in its getContentForInclusion() call, selectIndexFile() returns null,
and as a result fFallBackFactory is used, which is a SavedFilesProvider,
which creates InternalFileContent objects with InclusionKind.USE_SOURCE.

As a result, the header file's contents are actually re-parsed
and inserted into the AST of the source file.

Is this intentional? Does this sort of thing ever happen in


Back to the top