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

Follow up bug 287907: Clear result cache only once per IASTTranslationUnit.

This commit is contained in:
Markus Schorn 2010-01-27 18:19:43 +00:00
parent f85ec54f1c
commit 9524c4671f
6 changed files with 76 additions and 60 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -99,12 +99,12 @@ public class CIndex implements IIndex {
} else { } else {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();
for (int j = 0; j < linkages.length; j++) { for (ILinkage linkage : linkages) {
if (filter.acceptLinkage(linkages[j])) { if (filter.acceptLinkage(linkage)) {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindings(patterns, isFullyQualified, retargetFilter(linkages[j], filter), monitor); IBinding[] part = fFragments[i].findBindings(patterns, isFullyQualified, retargetFilter(linkage, filter), monitor);
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -112,7 +112,7 @@ public class CIndex implements IIndex {
fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
} }
} }
ICompositesFactory factory = getCompositesFactory(linkages[j].getLinkageID()); ICompositesFactory factory = getCompositesFactory(linkage.getLinkageID());
result.add(factory.getCompositeBindings(fragmentBindings)); result.add(factory.getCompositeBindings(fragmentBindings));
} }
} }
@ -126,12 +126,12 @@ public class CIndex implements IIndex {
} else { } else {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();
for (int j = 0; j < linkages.length; j++) { for (ILinkage linkage : linkages) {
if (filter.acceptLinkage(linkages[j])) { if (filter.acceptLinkage(linkage)) {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findMacroContainers(pattern, retargetFilter(linkages[j], filter), monitor); IBinding[] part = fFragments[i].findMacroContainers(pattern, retargetFilter(linkage, filter), monitor);
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -139,7 +139,7 @@ public class CIndex implements IIndex {
fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
} }
} }
ICompositesFactory factory = getCompositesFactory(linkages[j].getLinkageID()); ICompositesFactory factory = getCompositesFactory(linkage.getLinkageID());
result.add(factory.getCompositeBindings(fragmentBindings)); result.add(factory.getCompositeBindings(fragmentBindings));
} }
} }
@ -156,8 +156,7 @@ public class CIndex implements IIndex {
} }
if (bindings.length > 1) { if (bindings.length > 1) {
ArrayList<IIndexName> multi= new ArrayList<IIndexName>(); ArrayList<IIndexName> multi= new ArrayList<IIndexName>();
for (int i = 0; i < bindings.length; i++) { for (IBinding b : bindings) {
IBinding b = bindings[i];
multi.addAll(Arrays.asList(findNames(b, flags))); multi.addAll(Arrays.asList(findNames(b, flags)));
} }
return multi.toArray(new IIndexName[multi.size()]); return multi.toArray(new IIndexName[multi.size()]);
@ -221,8 +220,7 @@ public class CIndex implements IIndex {
BitSet linkages= new BitSet(); BitSet linkages= new BitSet();
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
IIndexFragmentFile[] candidates= fFragments[i].getFiles(location); IIndexFragmentFile[] candidates= fFragments[i].getFiles(location);
for (int j = 0; j < candidates.length; j++) { for (IIndexFragmentFile candidate : candidates) {
IIndexFragmentFile candidate= candidates[j];
int linkage= candidate.getLinkageID(); int linkage= candidate.getLinkageID();
if (!linkages.get(linkage) && candidate.hasContent()) { if (!linkages.get(linkage) && candidate.hasContent()) {
result.add(candidate); result.add(candidate);
@ -261,12 +259,11 @@ public class CIndex implements IIndex {
public void findIncludedBy(List<IIndexFile> in, List<IIndexInclude> out, int depth, HashSet<IIndexFileLocation> handled) throws CoreException { public void findIncludedBy(List<IIndexFile> in, List<IIndexInclude> out, int depth, HashSet<IIndexFileLocation> handled) throws CoreException {
List<IIndexFile> nextLevel= depth != 0 ? new LinkedList<IIndexFile>() : null; List<IIndexFile> nextLevel= depth != 0 ? new LinkedList<IIndexFile>() : null;
for (Iterator<IIndexFile> it= in.iterator(); it.hasNext(); ) { for (IIndexFile iIndexFile : in) {
IIndexFragmentFile file = (IIndexFragmentFile) it.next(); IIndexFragmentFile file = (IIndexFragmentFile) iIndexFile;
for (int j = 0; j < fPrimaryFragmentCount; j++) { for (int j = 0; j < fPrimaryFragmentCount; j++) {
IIndexInclude[] includedBy= fFragments[j].findIncludedBy(file); IIndexInclude[] includedBy= fFragments[j].findIncludedBy(file);
for (int k = 0; k < includedBy.length; k++) { for (IIndexInclude include : includedBy) {
IIndexInclude include = includedBy[k];
if (handled.add(include.getIncludedByLocation())) { if (handled.add(include.getIncludedByLocation())) {
out.add(include); out.add(include);
if (depth != 0) { if (depth != 0) {
@ -298,11 +295,10 @@ public class CIndex implements IIndex {
private void findIncludes(List<IIndexFile> in, List<IIndexInclude> out, int depth, HashSet<Object> handled) throws CoreException { private void findIncludes(List<IIndexFile> in, List<IIndexInclude> out, int depth, HashSet<Object> handled) throws CoreException {
List<IIndexFile> nextLevel= depth != 0 ? new LinkedList<IIndexFile>() : null; List<IIndexFile> nextLevel= depth != 0 ? new LinkedList<IIndexFile>() : null;
for (Iterator<IIndexFile> it= in.iterator(); it.hasNext(); ) { for (IIndexFile iIndexFile : in) {
IIndexFragmentFile file = (IIndexFragmentFile) it.next(); IIndexFragmentFile file = (IIndexFragmentFile) iIndexFile;
IIndexInclude[] includes= file.getIncludes(); IIndexInclude[] includes= file.getIncludes();
for (int k = 0; k < includes.length; k++) { for (IIndexInclude include : includes) {
IIndexInclude include = includes[k];
IIndexFileLocation target= include.getIncludesLocation(); IIndexFileLocation target= include.getIncludesLocation();
Object key= target != null ? (Object) target : include.getFullName(); Object key= target != null ? (Object) target : include.getFullName();
if (handled.add(key)) { if (handled.add(key)) {
@ -346,8 +342,8 @@ public class CIndex implements IIndex {
public synchronized void releaseReadLock() { public synchronized void releaseReadLock() {
if (--fReadLock == 0) { if (--fReadLock == 0) {
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
fFragments[i].releaseReadLock(); fFragment.releaseReadLock();
} }
} }
} }
@ -357,8 +353,8 @@ public class CIndex implements IIndex {
} }
public boolean hasWaitingReaders() { public boolean hasWaitingReaders() {
for (int i= 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
if (fFragments[i].hasWaitingReaders()) { if (fFragment.hasWaitingReaders()) {
return true; return true;
} }
} }
@ -367,8 +363,8 @@ public class CIndex implements IIndex {
public long getLastWriteAccess() { public long getLastWriteAccess() {
long result= 0; long result= 0;
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
result= Math.max(result, fFragments[i].getLastWriteAccess()); result= Math.max(result, fFragment.getLastWriteAccess());
} }
return result; return result;
} }
@ -388,12 +384,12 @@ public class CIndex implements IIndex {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();
monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length * linkages.length); monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length * linkages.length);
for (int j = 0; j < linkages.length; j++) { for (ILinkage linkage : linkages) {
if (filter.acceptLinkage(linkages[j])) { if (filter.acceptLinkage(linkage)) {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindings(names, retargetFilter(linkages[j], filter), new SubProgressMonitor(monitor, 1)); IBinding[] part = fFragments[i].findBindings(names, retargetFilter(linkage, filter), new SubProgressMonitor(monitor, 1));
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -401,7 +397,7 @@ public class CIndex implements IIndex {
fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
} }
} }
ICompositesFactory factory = getCompositesFactory(linkages[j].getLinkageID()); ICompositesFactory factory = getCompositesFactory(linkage.getLinkageID());
result.add(factory.getCompositeBindings(fragmentBindings)); result.add(factory.getCompositeBindings(fragmentBindings));
} }
} }
@ -460,8 +456,8 @@ public class CIndex implements IIndex {
public IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) throws CoreException { public IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) throws CoreException {
List<IIndexFragmentBinding> result = new ArrayList<IIndexFragmentBinding>(); List<IIndexFragmentBinding> result = new ArrayList<IIndexFragmentBinding>();
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
IIndexFragmentBinding adapted = fFragments[i].adaptBinding(binding); IIndexFragmentBinding adapted = fFragment.adaptBinding(binding);
if (adapted != null) { if (adapted != null) {
result.add(adapted); result.add(adapted);
} }
@ -513,12 +509,12 @@ public class CIndex implements IIndex {
} else { } else {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();
for (int j = 0; j < linkages.length; j++) { for (ILinkage linkage : linkages) {
if (filter.acceptLinkage(linkages[j])) { if (filter.acceptLinkage(linkage)) {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindingsForPrefix(prefix, filescope, retargetFilter(linkages[j], filter), monitor); IBinding[] part = fFragments[i].findBindingsForPrefix(prefix, filescope, retargetFilter(linkage, filter), monitor);
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -526,7 +522,7 @@ public class CIndex implements IIndex {
fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
} }
} }
ICompositesFactory factory = getCompositesFactory(linkages[j].getLinkageID()); ICompositesFactory factory = getCompositesFactory(linkage.getLinkageID());
result.add(factory.getCompositeBindings(fragmentBindings)); result.add(factory.getCompositeBindings(fragmentBindings));
} }
} }
@ -540,12 +536,12 @@ public class CIndex implements IIndex {
} else { } else {
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>(); List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
ILinkage[] linkages = Linkage.getIndexerLinkages(); ILinkage[] linkages = Linkage.getIndexerLinkages();
for (int j = 0; j < linkages.length; j++) { for (ILinkage linkage : linkages) {
if (filter.acceptLinkage(linkages[j])) { if (filter.acceptLinkage(linkage)) {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindings(name, filescope, retargetFilter(linkages[j], filter), monitor); IBinding[] part = fFragments[i].findBindings(name, filescope, retargetFilter(linkage, filter), monitor);
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -553,7 +549,7 @@ public class CIndex implements IIndex {
fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; fragmentBindings[i] = IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY;
} }
} }
ICompositesFactory factory = getCompositesFactory(linkages[j].getLinkageID()); ICompositesFactory factory = getCompositesFactory(linkage.getLinkageID());
result.add(factory.getCompositeBindings(fragmentBindings)); result.add(factory.getCompositeBindings(fragmentBindings));
} }
} }
@ -582,8 +578,7 @@ public class CIndex implements IIndex {
HashSet<IIndexFile> allowedFiles= new HashSet<IIndexFile>(); HashSet<IIndexFile> allowedFiles= new HashSet<IIndexFile>();
try { try {
IIndexMacro[] macros= fFragments[i].findMacros(name, isPrefix, caseSensitive, filter, new SubProgressMonitor(monitor, 1)); IIndexMacro[] macros= fFragments[i].findMacros(name, isPrefix, caseSensitive, filter, new SubProgressMonitor(monitor, 1));
for (int k = 0; k < macros.length; k++) { for (IIndexMacro indexMacro : macros) {
IIndexMacro indexMacro = macros[k];
IIndexFile file= indexMacro.getFile(); IIndexFile file= indexMacro.getFile();
if (!allowedFiles.contains(file)) { if (!allowedFiles.contains(file)) {
if (handledIFLs.add(file.getLocation())) { if (handledIFLs.add(file.getLocation())) {
@ -604,27 +599,27 @@ public class CIndex implements IIndex {
public long getCacheHits() { public long getCacheHits() {
long result= 0; long result= 0;
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
result+= fFragments[i].getCacheHits(); result+= fFragment.getCacheHits();
} }
return result; return result;
} }
public long getCacheMisses() { public long getCacheMisses() {
long result= 0; long result= 0;
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
result+= fFragments[i].getCacheMisses(); result+= fFragment.getCacheMisses();
} }
return result; return result;
} }
public void resetCacheCounters() { public void resetCacheCounters() {
for (int i = 0; i < fFragments.length; i++) { for (IIndexFragment fFragment : fFragments) {
fFragments[i].resetCacheCounters(); fFragment.resetCacheCounters();
} }
} }
void clearResultCaches() { protected void clearResultCache() {
for (IIndexFragment frag : fFragments) { for (IIndexFragment frag : fFragments) {
frag.clearResultCache(); frag.clearResultCache();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import java.util.Collection; import java.util.Collection;
@ -151,4 +150,9 @@ public interface IWritableIndex extends IIndex {
* Returns the size of the database in bytes. * Returns the size of the database in bytes.
*/ */
long getDatabaseSizeBytes(); long getDatabaseSizeBytes();
/**
* Clears the result cache, caller needs to hold a write-lock.
*/
void clearResultCache();
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import java.util.Collection; import java.util.Collection;
@ -134,11 +133,19 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
assert fIsWriteLocked: "No write lock to be released"; //$NON-NLS-1$ assert fIsWriteLocked: "No write lock to be released"; //$NON-NLS-1$
assert establishReadlockCount == getReadLockCount(): "Unexpected read lock is not allowed"; //$NON-NLS-1$ assert establishReadlockCount == getReadLockCount(): "Unexpected read lock is not allowed"; //$NON-NLS-1$
// Bug 297641: Result cache of read only providers needs to be cleared.
if (establishReadlockCount == 0) {
clearResultCache();
}
fIsWriteLocked= false; fIsWriteLocked= false;
fWritableFragment.releaseWriteLock(establishReadlockCount, flush); fWritableFragment.releaseWriteLock(establishReadlockCount, flush);
}
// Bug 297641: Result cache of read only providers needs to be cleared.
clearResultCaches(); @Override
public void clearResultCache() {
assert fIsWriteLocked: "Need to hold a write lock to clear result caches"; //$NON-NLS-1$
super.clearResultCache();
} }
public void flush() throws CoreException { public void flush() throws CoreException {

View file

@ -863,7 +863,10 @@ public class PDOM extends PlatformObject implements IPDOM {
@SuppressWarnings("nls") @SuppressWarnings("nls")
public void releaseWriteLock(int establishReadLocks, boolean flush) { public void releaseWriteLock(int establishReadLocks, boolean flush) {
clearResultCache(); // When all locks are released we can clear the result cache.
if (establishReadLocks == 0) {
clearResultCache();
}
try { try {
db.giveUpExclusiveLock(flush); db.giveUpExclusiveLock(flush);
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -219,6 +219,11 @@ abstract public class PDOMWriter {
} catch (AssertionError e) { } catch (AssertionError e) {
th= e; th= e;
} finally { } finally {
// When the caller holds a read-lock, the result cache of the index is never cleared.
// ==> Before releasing the lock for the last time in this ast, we clear the result cache.
if (readlockCount > 0 && i == ifls.length-1) {
index.clearResultCache();
}
lock.release(); lock.release();
} }
if (th != null) { if (th != null) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2009 QNX Software Systems and others. * Copyright (c) 2007, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -151,12 +151,14 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
} }
public void addBase(PDOMCPPBase base) throws CoreException { public void addBase(PDOMCPPBase base) throws CoreException {
getPDOM().removeCachedResult(record+PDOMCPPLinkage.CACHE_BASES);
PDOMCPPBase firstBase = getFirstBase(); PDOMCPPBase firstBase = getFirstBase();
base.setNextBase(firstBase); base.setNextBase(firstBase);
setFirstBase(base); setFirstBase(base);
} }
public void removeBase(PDOMName pdomName) throws CoreException { public void removeBase(PDOMName pdomName) throws CoreException {
getPDOM().removeCachedResult(record+PDOMCPPLinkage.CACHE_BASES);
PDOMCPPBase base= getFirstBase(); PDOMCPPBase base= getFirstBase();
PDOMCPPBase predecessor= null; PDOMCPPBase predecessor= null;
long nameRec= pdomName.getRecord(); long nameRec= pdomName.getRecord();