Community
Participate
Working Groups
Build Identifier: I20120608-1400 Consider the following code structure (which contains cyclic includes): //file:main.cpp #include "A.h" //file:A.h #include "B.h" //file:B.h #include "C.h" #include "D.h" //file:C.h #include "A.h" //file:D.h /*...*/ when calling bDotHIndexFile.getIncludes(), I get an include to C.h (which is correct, but the one to D.h is missing. Notice: In CDT 8.0.2, I did get both IIndexInclude instances. Reproducible: Always
Do you know any compiler which can actually compile this code ? I'm not sure it makes sense talking about API return values for invalid input ("garbage in, garbage out"). To me it seems natural that the recursion must be broken somewhere.
I don't think it's unreasonable to expect that IIndexFile.getIncludes() returns all the includes present in a file, regardless of whether or not there is a cycle in the include graph. This is and of itself should not cause infinite recursion; doing certain operations on the includes could, but then it should be responsibility of those operations to protect against that. As an example of how this might actually be useful: a plugin may want to use this API to _detect_ (and, say, warn about) cyclic includes.