1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Completed optimization #2 in PR 91801: [Indexer] Optimize header file visiting/indexing. Encountered headers are removed before instead of after indexing the whole project, thus enabling 'index external headers only once' optimization to be applied for file/directory indexing.

This commit is contained in:
Vladimir Hirsl 2005-06-20 20:35:42 +00:00
parent 7475da7bda
commit 77121513be
3 changed files with 16 additions and 25 deletions

View file

@ -1,3 +1,12 @@
2005-06-20 Vladimir Hirsl
Completed optimization #2 in PR 91801: [Indexer] Optimize header file visiting/indexing
Encountered headers are removed before instead of after indexing the whole project, thus
enabling 'index external headers only once' optimization to be applied for file/directory
indexing.
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMAddFolderToIndex.java
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/DOMIndexAllProject.java
2005-06-17 Vladimir Hirsl
Fix for 95174: [Search Engine][DOM AST Indexer] does not find definition of a method

View file

@ -34,7 +34,6 @@ public class DOMAddFolderToIndex extends DOMIndexRequest {
char[][] exclusionPattern;
ArrayList sourceFilesToIndex;
ArrayList headerFilesToIndex;
boolean cleanEncouteredHeaders;
public DOMAddFolderToIndex(IPath folderPath, IProject project, char[][] exclusionPattern, DOMSourceIndexer indexer) {
super(project.getFullPath(), indexer);
@ -43,17 +42,6 @@ public class DOMAddFolderToIndex extends DOMIndexRequest {
this.exclusionPattern = exclusionPattern;
this.sourceFilesToIndex = new ArrayList();
this.headerFilesToIndex = new ArrayList();
this.cleanEncouteredHeaders = false;
}
public DOMAddFolderToIndex(IPath folderPath, IProject project, char[][] exclusionPattern, DOMSourceIndexer indexer, boolean cleanEncounteredHeaders) {
super(project.getFullPath(), indexer);
this.folderPath = folderPath;
this.project = project;
this.exclusionPattern = exclusionPattern;
this.sourceFilesToIndex = new ArrayList();
this.headerFilesToIndex = new ArrayList();
this.cleanEncouteredHeaders = cleanEncounteredHeaders;
}
public boolean execute(IProgressMonitor progressMonitor) {
@ -72,7 +60,7 @@ public class DOMAddFolderToIndex extends DOMIndexRequest {
try {
monitor.enterRead(); // ask permission to read
final IPath container = this.indexPath;
// final IPath container = this.indexPath;
//final IndexManager indexManager = this.manager;
final char[][] pattern = exclusionPattern;
folder.accept(
@ -119,11 +107,6 @@ public class DOMAddFolderToIndex extends DOMIndexRequest {
for (int i=0;i<headerFilesToIndex.size(); i++)
this.indexer.addSource((IFile)headerFilesToIndex.get(i), this.indexPath, true);
if (cleanEncouteredHeaders){
CleanEncounteredHeaders cleanHeaders = new CleanEncounteredHeaders(this.indexer);
this.indexer.request(cleanHeaders);
}
}
public String toString() {

View file

@ -54,8 +54,6 @@ public class DOMIndexAllProject extends DOMIndexRequest {
if (progressMonitor != null && progressMonitor.isCanceled()) return true;
if (!project.isAccessible()) return true; // nothing to do
String test = this.indexPath.toOSString();
IIndex index = indexer.getIndex(this.indexPath, true, /*reuse index file*/ true /*create if none*/);
if (index == null) return true;
ReadWriteMonitor monitor = indexer.getMonitorFor(index);
@ -86,20 +84,21 @@ public class DOMIndexAllProject extends DOMIndexRequest {
if (cProject == null)
return false;
// first clean encountered headers
CleanEncounteredHeaders cleanHeaders = new CleanEncounteredHeaders(this.indexer);
this.indexer.request(cleanHeaders);
//Get the source roots for this project
ISourceRoot[] sourceRoot = cProject.getSourceRoots();
for (int i=0;i<sourceRoot.length;i++){
if (sourceRoot[i] instanceof SourceRoot){
ISourceEntry tempEntry = ((SourceRoot) sourceRoot[i]).getSourceEntry();
if ((i+1) != sourceRoot.length)
indexer.request(new DOMAddFolderToIndex(sourceRoot[i].getPath(), project, tempEntry.fullExclusionPatternChars(), indexer));
else
indexer.request(new DOMAddFolderToIndex(sourceRoot[i].getPath(), project, tempEntry.fullExclusionPatternChars(),indexer,true));
indexer.request(new DOMAddFolderToIndex(sourceRoot[i].getPath(), project, tempEntry.fullExclusionPatternChars(), indexer));
}
}
// request to save index when all cus have been indexed
// request to save index when all cus have been indexed
indexer.request(new DOMSaveIndex(this.indexPath, indexer));
} catch (CoreException e) {
if (IndexManager.VERBOSE) {