1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 534330 - Only create an index for the project containing the TU being analyzed in CxxModelsCache.getIndex()

Change-Id: I3391e1201b51ab32c35c73cfb2f861614da07057
This commit is contained in:
Nathan Ridge 2018-05-04 00:48:38 -04:00
parent 77045f1942
commit cc23d88b54

View file

@ -21,8 +21,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter;
import org.eclipse.core.resources.IFile;
@ -120,8 +118,7 @@ public class CxxModelsCache implements ICodanDisposable {
public synchronized IIndex getIndex() throws CoreException, OperationCanceledException {
Assert.isTrue(!disposed, "CxxASTCache is already disposed."); //$NON-NLS-1$
if (this.index == null) {
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
IIndex index = CCorePlugin.getIndexManager().getIndex(projects);
IIndex index = CCorePlugin.getIndexManager().getIndex(tu.getCProject());
try {
index.acquireReadLock();
} catch (InterruptedException e) {