mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed a bug that caused files to disappear from the index sometimes.
This commit is contained in:
parent
0dfb1ee847
commit
600c3b1b32
2 changed files with 6 additions and 3 deletions
|
@ -74,6 +74,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
public static enum UnusedHeaderStrategy { skip, useC, useCPP, useDefaultLanguage, useBoth }
|
||||
private static final int MAX_ERRORS = 500;
|
||||
|
||||
// Order of constants is important. Stronger update types have to precede the weaker ones.
|
||||
private static enum UpdateKind { REQUIRED_SOURCE, REQUIRED_HEADER, ONE_LINKAGE_HEADER, OTHER_HEADER }
|
||||
|
||||
private static class LinkageTask {
|
||||
|
@ -119,7 +120,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
boolean requestUpdate(IIndexFragmentFile ifile, Object tu, UpdateKind kind) {
|
||||
if (tu != null)
|
||||
fTu= tu;
|
||||
if (fKind == null)
|
||||
// Change fKind only if it becomes stronger as a result.
|
||||
if (fKind == null || (kind != null && kind.compareTo(fKind) < 0))
|
||||
fKind= kind;
|
||||
|
||||
if (ifile == null) {
|
||||
|
|
|
@ -200,6 +200,7 @@ import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
|
|||
|
||||
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
|
@ -1286,11 +1287,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
try {
|
||||
IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
if (tuToReset != null) {
|
||||
indexManager.update(new ICElement[] { tuToReset },
|
||||
indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToReset) },
|
||||
IIndexManager.RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||
}
|
||||
if (tuToAdd != null) {
|
||||
indexManager.update(new ICElement[] { tuToAdd },
|
||||
indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToAdd) },
|
||||
IIndexManager.FORCE_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue