diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index c41b5ac5898..cf628dbf052 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -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) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 97de48f8931..d4dd71a7069 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -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) {