diff options
author | Sergey Prigogin | 2013-12-06 18:57:05 +0000 |
---|---|---|
committer | Sergey Prigogin | 2013-12-06 20:31:23 +0000 |
commit | 63c70d737ea11a2ee6de1f4924c892ab72d6b3c0 (patch) | |
tree | 183a37436b7e434c264502789046f402fabf1e78 | |
parent | d144de5c1d527ab402fcc38f915790df8b582ec3 (diff) | |
download | org.eclipse.cdt-cdt_8_2.tar.gz org.eclipse.cdt-cdt_8_2.tar.xz org.eclipse.cdt-cdt_8_2.zip |
-rw-r--r-- | core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java | 9 |
1 files changed, 7 insertions, 2 deletions
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 d9553b3c75b..d1f86e092ac 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 @@ -1006,6 +1006,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private DependsOnOutdatedFileException parseFile(Object tu, AbstractLanguage lang, IIndexFileLocation ifl, IScannerInfo scanInfo, FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException { + boolean resultCacheCleared = false; IPath path= getLabel(ifl); Throwable th= null; try { @@ -1025,6 +1026,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { // to the index. ((ASTTranslationUnit) ast).setOriginatingTranslationUnit((ITranslationUnit) tu); writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, pm); + resultCacheCleared = true; // The cache was cleared while writing to the index. } } catch (CoreException e) { th= e; @@ -1044,8 +1046,11 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } if (th != null) { swallowError(path, th); - // In case of a parsing error the result cache may not have been cleared. - // Clear if under a write lock to reduce interference with index readers. + } + + if (!resultCacheCleared) { + // If the result cache has not been cleared, clear it under a write lock to reduce + // interference with index readers. fIndex.acquireWriteLock(); try { fIndex.clearResultCache(); |