Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] StackOverflowError in IndexFileSet.containsNonLocalDeclaration

Bug http://eclip.se/429196 describes a specific case that causes a StackOverflowError.

I’m trying to understand the reason for the code in IndexFileSet.containsNonLocalDeclaration, which looks like:

@Override
public boolean containsNonLocalDeclaration(IBinding binding, IIndexFragment ignore) {
    for (Map.Entry<IIndexFragment, IIndexFragmentFileSet> entry : fSubSets.entrySet()) {
        try {
            final IIndexFragment fragment = entry.getKey();
            final IIndexFragmentFileSet subset = entry.getValue();
            if (fragment != ignore) {
                IIndexFragmentName[] names =
                    fragment.findNames(binding, IIndexFragment.FIND_DECLARATIONS_DEFINITIONS | IIndexFragment.FIND_NON_LOCAL_ONLY);
                for (IIndexFragmentName name : names) {
                    try {
                        if (subset.contains((IIndexFragmentFile) name.getFile())) {
                            return true;
                        }
                    } catch (CoreException e) {
                        CCorePlugin.log(e);
                    }
                }
            }
        } catch (CoreException e) {
            CCorePlugin.log(e);
        }
    }
    return false;
}

I think this is looking for non-local PDOMBindings for the AST binding that is passed in (which is an instance of CPPVariable in this case).

Does anyone know why this code collects all PDOMNames from the entire fragment and then eliminates the ones that aren’t in the file-set’s files. Could it not start by collecting names from the PDOMFiles that are in the subset?

-Andrew


Back to the top