Bug 386039 - IIndexFile.getIncludes() fails to yield all expected IIndexInclude (since update to Juno)
Summary: IIndexFile.getIncludes() fails to yield all expected IIndexInclude (since upd...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-26 09:10 EDT by Lukas Felber CLA
Modified: 2020-09-04 15:17 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Felber CLA 2012-07-26 09:10:47 EDT
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
Comment 1 Martin Oberhuber CLA 2013-06-25 10:04:03 EDT
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.
Comment 2 Nathan Ridge CLA 2014-04-18 00:34:11 EDT
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.