Skip to main content

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

I don't think this can be intentional. I have a suspicion that the problem doesn't manifest itself outside of tests because otherwise somebody would have noticed it earlier. At Google we never use dependent C/C++ projects, so I don't have much experience with them.

-sergey


On Mon, Aug 18, 2014 at 1:38 AM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
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
production?

Thanks,
Nate

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top