Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 287907 | Differences between
and this patch

Collapse All | Expand All

(-)parser/org/eclipse/cdt/core/index/IIndex.java (+6 lines)
Lines 92-97 Link Here
92
	public void releaseReadLock();
92
	public void releaseReadLock();
93
	
93
	
94
	/**
94
	/**
95
	 * @return <code>true</code> if there are threads waiting for read locks.
96
	 * @since 5.2
97
	 */
98
	public boolean hasWaitingReaders();
99
100
	/**
95
	 * Returns a timestamp of when the index was last written to. This can
101
	 * Returns a timestamp of when the index was last written to. This can
96
	 * be used to figure out whether information read from the index is 
102
	 * be used to figure out whether information read from the index is 
97
	 * still reliable or not.
103
	 * still reliable or not.
(-)parser/org/eclipse/cdt/internal/core/index/CIndex.java (+9 lines)
Lines 355-360 Link Here
355
		return fReadLock;
355
		return fReadLock;
356
	}
356
	}
357
357
358
	public boolean hasWaitingReaders() {
359
		for (int i= 0; i < fFragments.length; i++) {
360
			if (fFragments[i].hasWaitingReaders()) {
361
				return true;
362
			}
363
		}
364
		return false;
365
	}
366
358
	public long getLastWriteAccess() {
367
	public long getLastWriteAccess() {
359
		long result= 0;
368
		long result= 0;
360
		for (int i = 0; i < fFragments.length; i++) {
369
		for (int i = 0; i < fFragments.length; i++) {
(-)parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java (+4 lines)
Lines 85-90 Link Here
85
	public void releaseReadLock() {
85
	public void releaseReadLock() {
86
	}
86
	}
87
87
88
	public boolean hasWaitingReaders() {
89
		return false;
90
	}
91
88
	public long getLastWriteAccess() {
92
	public long getLastWriteAccess() {
89
		return 0;
93
		return 0;
90
	}
94
	}
(-)parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java (+5 lines)
Lines 191-196 Link Here
191
	void releaseReadLock();
191
	void releaseReadLock();
192
	
192
	
193
	/**
193
	/**
194
	 * @return <code>true</code> if there are threads waiting for read locks.
195
	 */
196
	public boolean hasWaitingReaders();
197
198
	/**
194
	 * Returns the timestamp of the last modification to the index.
199
	 * Returns the timestamp of the last modification to the index.
195
	 */
200
	 */
196
	long getLastWriteAccess();
201
	long getLastWriteAccess();
(-)parser/org/eclipse/cdt/internal/core/index/IWritableIndex.java (-2 / +17 lines)
Lines 21-26 Link Here
21
import org.eclipse.cdt.core.index.IIndexFile;
21
import org.eclipse.cdt.core.index.IIndexFile;
22
import org.eclipse.cdt.core.index.IIndexFileLocation;
22
import org.eclipse.cdt.core.index.IIndexFileLocation;
23
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
23
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
24
import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
24
import org.eclipse.core.runtime.CoreException;
25
import org.eclipse.core.runtime.CoreException;
25
26
26
/**
27
/**
Lines 65-71 Link Here
65
	/**
66
	/**
66
	 * Creates a file object for the given location or returns an existing one.
67
	 * Creates a file object for the given location or returns an existing one.
67
	 */
68
	 */
68
	IIndexFragmentFile addFile(int linkageID, IIndexFileLocation fileLocation) throws CoreException;
69
	IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location) throws CoreException;
70
71
	/**
72
	 * Creates a uncommitted file object for the given location.
73
	 */
74
	IIndexFragmentFile addUncommittedFile(int linkageID, IIndexFileLocation location) throws CoreException;
75
76
	/**
77
	 * Makes an uncommitted file that was created earlier by calling
78
	 * {@link #addUncommittedFile(int, IIndexFileLocation)} method visible in the index.
79
	 *
80
	 * @return The file that was updated.
81
	 * @throws CoreException
82
	 */
83
	IIndexFragmentFile commitUncommittedFile() throws CoreException;
69
84
70
	/**
85
	/**
71
	 * Adds content to the given file.
86
	 * Adds content to the given file.
Lines 73-79 Link Here
73
	void setFileContent(IIndexFragmentFile sourceFile, 
88
	void setFileContent(IIndexFragmentFile sourceFile, 
74
			int linkageID, IncludeInformation[] includes, 
89
			int linkageID, IncludeInformation[] includes, 
75
			IASTPreprocessorStatement[] macros, IASTName[][] names,
90
			IASTPreprocessorStatement[] macros, IASTName[][] names,
76
			ASTFilePathResolver resolver) throws CoreException;
91
			ASTFilePathResolver resolver, YieldableIndexLock lock) throws CoreException, InterruptedException;
77
92
78
	/**
93
	/**
79
	 * Clears the entire index.
94
	 * Clears the entire index.
(-)parser/org/eclipse/cdt/internal/core/index/IWritableIndexFragment.java (-6 / +25 lines)
Lines 19-24 Link Here
19
import org.eclipse.cdt.core.index.IIndexFileLocation;
19
import org.eclipse.cdt.core.index.IIndexFileLocation;
20
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
20
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
21
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
21
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
22
import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.CoreException;
23
24
24
/**
25
/**
Lines 41-58 Link Here
41
42
42
	/**
43
	/**
43
	 * Creates a file object for the given location and linkage or returns an existing one.
44
	 * Creates a file object for the given location and linkage or returns an existing one.
44
	 * @param fileLocation an IIndexFileLocation representing the location of the file
45
	 * @param fileLocation an IIndexFileLocation representing the location of the file.
45
	 * @return the existing IIndexFragmentFile for this location, or a newly created one 
46
	 * @return the existing IIndexFragmentFile for this location, or a newly created one. 
46
	 * @throws CoreException
47
	 * @throws CoreException
47
	 */
48
	 */
48
	IIndexFragmentFile addFile(int linkageID, IIndexFileLocation fileLocation) throws CoreException;
49
	IIndexFragmentFile addFile(int linkageID, IIndexFileLocation fileLocation) throws CoreException;
49
50
50
	/**
51
	/**
51
	 * Adds an include to the given file.
52
	 * Creates a file object for the given location and linkage. The created file object is not added to
53
	 * the file index.
54
	 * @param fileLocation an IIndexFileLocation representing the location of the file.
55
	 * @return a newly created IIndexFragmentFile. 
56
	 * @throws CoreException
57
	 */
58
	IIndexFragmentFile addUncommittedFile(int linkageID, IIndexFileLocation fileLocation) throws CoreException;
59
60
	/**
61
	 * Makes the file that was created earlier by calling {@link #addUncommittedFile(int, IIndexFileLocation)}
62
	 * visible in the index.
63
     *
64
	 * @return The file that was updated.
65
	 * @throws CoreException
66
	 */
67
	IIndexFragmentFile commitUncommittedFile() throws CoreException;
68
69
	/**
70
	 * Adds includes, macros and names to the given file.
52
	 */
71
	 */
53
	void addFileContent(IIndexFragmentFile sourceFile, 
72
	void addFileContent(IIndexFragmentFile sourceFile, IncludeInformation[] includes,  
54
			IncludeInformation[] includes,  
73
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver resolver,
55
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver resolver) throws CoreException;
74
			YieldableIndexLock lock) throws CoreException, InterruptedException;
56
75
57
	/**
76
	/**
58
	 * Acquires a write lock, while giving up a certain amount of read locks.
77
	 * Acquires a write lock, while giving up a certain amount of read locks.
(-)parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java (-6 / +15 lines)
Lines 19-24 Link Here
19
import org.eclipse.cdt.core.index.IIndexFile;
19
import org.eclipse.cdt.core.index.IIndexFile;
20
import org.eclipse.cdt.core.index.IIndexFileLocation;
20
import org.eclipse.cdt.core.index.IIndexFileLocation;
21
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
21
import org.eclipse.cdt.internal.core.pdom.ASTFilePathResolver;
22
import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.CoreException;
23
24
24
public class WritableCIndex extends CIndex implements IWritableIndex {
25
public class WritableCIndex extends CIndex implements IWritableIndex {
Lines 50-66 Link Here
50
		return fWritableFragment.getFiles(location);
51
		return fWritableFragment.getFiles(location);
51
	}
52
	}
52
53
53
	public IIndexFragmentFile addFile(int linkageID, IIndexFileLocation fileLocation) throws CoreException {
54
	public IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location) throws CoreException {
54
		return fWritableFragment.addFile(linkageID, fileLocation);
55
		return fWritableFragment.addFile(linkageID, location);
56
	}
57
58
	public IIndexFragmentFile addUncommittedFile(int linkageID, IIndexFileLocation location) throws CoreException {
59
		return fWritableFragment.addUncommittedFile(linkageID, location);
60
	}
61
62
	public IIndexFragmentFile commitUncommittedFile() throws CoreException {
63
		return fWritableFragment.commitUncommittedFile();
55
	}
64
	}
56
65
57
	private boolean isWritableFragment(IIndexFragment frag) {
66
	private boolean isWritableFragment(IIndexFragment frag) {
58
		return frag == fWritableFragment;
67
		return frag == fWritableFragment;
59
	}
68
	}
60
69
61
	public void setFileContent(IIndexFragmentFile file, int linkageID,
70
	public void setFileContent(IIndexFragmentFile file, int linkageID, IncludeInformation[] includes,
62
			IncludeInformation[] includes,
71
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver resolver,
63
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver resolver) throws CoreException {
72
			YieldableIndexLock lock) throws CoreException, InterruptedException {
64
		IIndexFragment indexFragment = file.getIndexFragment();
73
		IIndexFragment indexFragment = file.getIndexFragment();
65
		if (!isWritableFragment(indexFragment)) {
74
		if (!isWritableFragment(indexFragment)) {
66
			assert false : "Attempt to update file of read-only fragment"; //$NON-NLS-1$
75
			assert false : "Attempt to update file of read-only fragment"; //$NON-NLS-1$
Lines 70-76 Link Here
70
					ii.fTargetFile= addFile(linkageID, ii.fLocation);
79
					ii.fTargetFile= addFile(linkageID, ii.fLocation);
71
				}
80
				}
72
			}
81
			}
73
			((IWritableIndexFragment) indexFragment).addFileContent(file, includes, macros, names, resolver);
82
			((IWritableIndexFragment) indexFragment).addFileContent(file, includes, macros, names, resolver, lock);
74
		}
83
		}
75
	}
84
	}
76
85
(-)parser/org/eclipse/cdt/internal/core/pdom/PDOM.java (-8 / +27 lines)
Lines 48-53 Link Here
48
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
48
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
49
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
49
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
50
import org.eclipse.cdt.core.index.IIndexBinding;
50
import org.eclipse.cdt.core.index.IIndexBinding;
51
import org.eclipse.cdt.core.index.IIndexFile;
51
import org.eclipse.cdt.core.index.IIndexFileLocation;
52
import org.eclipse.cdt.core.index.IIndexFileLocation;
52
import org.eclipse.cdt.core.index.IIndexLinkage;
53
import org.eclipse.cdt.core.index.IIndexLinkage;
53
import org.eclipse.cdt.core.index.IIndexLocationConverter;
54
import org.eclipse.cdt.core.index.IIndexLocationConverter;
Lines 341-347 Link Here
341
		}
342
		}
342
	}
343
	}
343
344
344
	private PDOMLinkage createLinkage(int linkageID) throws CoreException {
345
	protected PDOMLinkage createLinkage(int linkageID) throws CoreException {
345
		PDOMLinkage pdomLinkage= fLinkageIDCache.get(linkageID);
346
		PDOMLinkage pdomLinkage= fLinkageIDCache.get(linkageID);
346
		if (pdomLinkage == null) {
347
		if (pdomLinkage == null) {
347
			final String linkageName= Linkage.getLinkageName(linkageID);
348
			final String linkageName= Linkage.getLinkageName(linkageID);
Lines 783-789 Link Here
783
		}
784
		}
784
	}
785
	}
785
786
786
787
	public void releaseReadLock() {
787
	public void releaseReadLock() {
788
		boolean clearCache= false;
788
		boolean clearCache= false;
789
		synchronized (mutex) {
789
		synchronized (mutex) {
Lines 884-889 Link Here
884
		fireChange(event);
884
		fireChange(event);
885
	}
885
	}
886
886
887
	public boolean hasWaitingReaders() {
888
		synchronized (mutex) {
889
			return waitingReaders > 0;
890
		}
891
	}
892
	
887
	public long getLastWriteAccess() {
893
	public long getLastWriteAccess() {
888
		return lastWriteAccess;
894
		return lastWriteAccess;
889
	}
895
	}
Lines 957-973 Link Here
957
		PDOMName name;
963
		PDOMName name;
958
		if ((options & FIND_DECLARATIONS) != 0) {
964
		if ((options & FIND_DECLARATIONS) != 0) {
959
			for (name= pdomBinding.getFirstDeclaration(); name != null; name= name.getNextInBinding()) {
965
			for (name= pdomBinding.getFirstDeclaration(); name != null; name= name.getNextInBinding()) {
960
				names.add(name);
966
				addName(name, names);
961
			}
967
			}
962
		}
968
		}
963
		if ((options & FIND_DEFINITIONS) != 0) {
969
		if ((options & FIND_DEFINITIONS) != 0) {
964
			for (name = pdomBinding.getFirstDefinition(); name != null; name= name.getNextInBinding()) {
970
			for (name = pdomBinding.getFirstDefinition(); name != null; name= name.getNextInBinding()) {
965
				names.add(name);
971
				addName(name, names);
966
			}
972
			}
967
		}
973
		}
968
		if ((options & FIND_REFERENCES) != 0) {
974
		if ((options & FIND_REFERENCES) != 0) {
969
			for (name = pdomBinding.getFirstReference(); name != null; name= name.getNextInBinding()) {
975
			for (name = pdomBinding.getFirstReference(); name != null; name= name.getNextInBinding()) {
970
				names.add(name);
976
				addName(name, names);
971
			}
977
			}
972
		}
978
		}
973
	}
979
	}
Lines 978-1000 Link Here
978
			for (PDOMMacro macro= container.getFirstDefinition(); macro != null; macro= macro.getNextInContainer()) {
984
			for (PDOMMacro macro= container.getFirstDefinition(); macro != null; macro= macro.getNextInContainer()) {
979
				final IIndexFragmentName name = macro.getDefinition();
985
				final IIndexFragmentName name = macro.getDefinition();
980
				if (name != null) {
986
				if (name != null) {
981
					names.add(name);
987
					addName(name, names);
982
				}
988
				}
983
			}
989
			}
984
		}
990
		}
985
		if ((options & FIND_REFERENCES) != 0) {
991
		if ((options & FIND_REFERENCES) != 0) {
986
			for (PDOMMacroReferenceName name = container.getFirstReference(); name != null; name= name.getNextInContainer()) {
992
			for (PDOMMacroReferenceName name = container.getFirstReference(); name != null; name= name.getNextInContainer()) {
987
				names.add(name);
993
				addName(name, names);
988
			}
994
			}
989
		}
995
		}
990
	}
996
	}
991
997
998
	private void addName(IIndexFragmentName name, ArrayList<IIndexFragmentName> names) throws CoreException {
999
		IIndexFile file = name.getFile();
1000
		if (file == null || file.getTimestamp() > 0) {
1001
			names.add(name);
1002
		}
1003
	}
1004
992
	public IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException {
1005
	public IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException {
993
		PDOMFile pdomFile= adaptFile(file);
1006
		PDOMFile pdomFile= adaptFile(file);
994
		if (pdomFile != null) {
1007
		if (pdomFile != null) {
995
			List<PDOMInclude> result = new ArrayList<PDOMInclude>();
1008
			List<PDOMInclude> result = new ArrayList<PDOMInclude>();
996
			for (PDOMInclude i= pdomFile.getFirstIncludedBy(); i != null; i= i.getNextInIncludedBy()) {
1009
			for (PDOMInclude i= pdomFile.getFirstIncludedBy(); i != null; i= i.getNextInIncludedBy()) {
997
				result.add(i);
1010
				if (i.getIncludedBy().getTimestamp() > 0) {
1011
					result.add(i);
1012
				}
998
			}
1013
			}
999
			return result.toArray(new PDOMInclude[result.size()]);
1014
			return result.toArray(new PDOMInclude[result.size()]);
1000
		}
1015
		}
Lines 1197-1202 Link Here
1197
	public String createKeyForCache(long record, char[] name) {
1212
	public String createKeyForCache(long record, char[] name) {
1198
		return new StringBuilder(name.length+2).append((char) (record >> 16)).append((char) record).append(name).toString();
1213
		return new StringBuilder(name.length+2).append((char) (record >> 16)).append((char) record).append(name).toString();
1199
	}
1214
	}
1215
1216
	public boolean hasLastingDefinition(PDOMBinding binding) throws CoreException {
1217
		return binding.hasDefinition();
1218
	}
1200
	
1219
	
1201
	private PDOMBinding[] getCrossLanguageBindings(IBinding binding) throws CoreException {
1220
	private PDOMBinding[] getCrossLanguageBindings(IBinding binding) throws CoreException {
1202
		switch(binding.getLinkage().getLinkageID()) {
1221
		switch(binding.getLinkage().getLinkageID()) {
(-)parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java (+4 lines)
Lines 187-192 Link Here
187
		}
187
		}
188
	}
188
	}
189
189
190
	public boolean hasWaitingReaders() {
191
		return fDelegate != null && fDelegate.hasWaitingReaders();
192
	}
193
190
	public synchronized void resetCacheCounters() {
194
	public synchronized void resetCacheCounters() {
191
		if (fDelegate != null)
195
		if (fDelegate != null)
192
			fDelegate.resetCacheCounters();
196
			fDelegate.resetCacheCounters();
(-)parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java (-13 / +41 lines)
Lines 46-51 Link Here
46
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
46
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
47
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
47
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
48
import org.eclipse.cdt.core.index.IIndexFileLocation;
48
import org.eclipse.cdt.core.index.IIndexFileLocation;
49
import org.eclipse.cdt.core.index.IIndexInclude;
49
import org.eclipse.cdt.core.parser.IProblem;
50
import org.eclipse.cdt.core.parser.IProblem;
50
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
51
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
51
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
52
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
Lines 68-73 Link Here
68
 * @since 4.0
69
 * @since 4.0
69
 */
70
 */
70
abstract public class PDOMWriter {
71
abstract public class PDOMWriter {
72
	public static boolean FINE_GRAINED_LOCKING = true;
71
	public static int SKIP_ALL_REFERENCES= -1;
73
	public static int SKIP_ALL_REFERENCES= -1;
72
	public static int SKIP_TYPE_REFERENCES= 1;
74
	public static int SKIP_TYPE_REFERENCES= 1;
73
	public static int SKIP_MACRO_REFERENCES= 2;
75
	public static int SKIP_MACRO_REFERENCES= 2;
Lines 200-210 Link Here
200
				if (fShowActivity) {
202
				if (fShowActivity) {
201
					trace("Indexer: adding " + ifl.getURI());  //$NON-NLS-1$
203
					trace("Indexer: adding " + ifl.getURI());  //$NON-NLS-1$
202
				}
204
				}
203
				index.acquireWriteLock(readlockCount);
204
				long start= System.currentTimeMillis();
205
				Throwable th= null;
205
				Throwable th= null;
206
				YieldableIndexLock lock = new YieldableIndexLock(index, readlockCount, flushIndex);
207
				lock.acquire();
206
				try {
208
				try {
207
					storeFileInIndex(index, ifl, symbolMap, linkageID, configHash, contextIncludes);
209
					storeFileInIndex(index, ifl, symbolMap, linkageID, configHash, contextIncludes, lock);
208
				} catch (RuntimeException e) {
210
				} catch (RuntimeException e) {
209
					th= e; 
211
					th= e; 
210
				} catch (PDOMNotImplementedError e) {
212
				} catch (PDOMNotImplementedError e) {
Lines 214-220 Link Here
214
				} catch (AssertionError e) {
216
				} catch (AssertionError e) {
215
					th= e;
217
					th= e;
216
				} finally {
218
				} finally {
217
					index.releaseWriteLock(readlockCount, flushIndex);
219
					lock.release();
218
				}
220
				}
219
				if (th != null) {
221
				if (th != null) {
220
					stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing,
222
					stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing,
Lines 223-229 Link Here
223
				if (i < ifls.length - 1) {
225
				if (i < ifls.length - 1) {
224
					updateFileCount(0, 0, 1); // update header count
226
					updateFileCount(0, 0, 1); // update header count
225
				}
227
				}
226
				fStatistics.fAddToIndexTime += System.currentTimeMillis() - start;
228
				fStatistics.fAddToIndexTime += lock.getCumulativeLockTime();
227
			}
229
			}
228
		}
230
		}
229
	}
231
	}
Lines 448-463 Link Here
448
450
449
	private IIndexFragmentFile storeFileInIndex(IWritableIndex index, IIndexFileLocation location,
451
	private IIndexFragmentFile storeFileInIndex(IWritableIndex index, IIndexFileLocation location,
450
			Map<IIndexFileLocation, Symbols> symbolMap, int linkageID, int configHash,
452
			Map<IIndexFileLocation, Symbols> symbolMap, int linkageID, int configHash,
451
			Set<IASTPreprocessorIncludeStatement> contextIncludes) throws CoreException {
453
			Set<IASTPreprocessorIncludeStatement> contextIncludes, YieldableIndexLock lock)
454
			throws CoreException, InterruptedException {
452
		Set<IIndexFileLocation> clearedContexts= Collections.emptySet();
455
		Set<IIndexFileLocation> clearedContexts= Collections.emptySet();
453
		IIndexFragmentFile file= index.getWritableFile(linkageID, location);
456
		IIndexFragmentFile file;
454
		if (file != null) {
457
		long timestamp = fResolver.getLastModified(location);
455
			clearedContexts= new HashSet<IIndexFileLocation>();
458
		if (FINE_GRAINED_LOCKING) {
456
			index.clearFile(file, clearedContexts);
459
			// In fine grained locking mode we create a temporary PDOMFile with zero timestamp,
460
			// add names to it, then replace contents of the old file from the temporary one, then
461
			// delete the temporary file. The write lock on the index is periodically yielded while
462
			// adding names to the temporary file, if the process takes long time.
463
			IIndexFragmentFile oldFile = index.getWritableFile(linkageID, location);
464
			if (oldFile != null) {
465
				IIndexInclude[] includedBy = index.findIncludedBy(oldFile);
466
				if (includedBy.length > 0) {
467
					clearedContexts= new HashSet<IIndexFileLocation>();
468
					for (IIndexInclude include : includedBy) {
469
						clearedContexts.add(include.getIncludedByLocation());
470
					}
471
				}
472
			}
473
			file= index.addUncommittedFile(linkageID, location);
457
		} else {
474
		} else {
458
			file= index.addFile(linkageID, location);
475
			file= index.getWritableFile(linkageID, location);
476
			if (file != null) {
477
				clearedContexts= new HashSet<IIndexFileLocation>();
478
				index.clearFile(file, clearedContexts);
479
			} else {
480
				file= index.addFile(linkageID, location);
481
			}
482
			file.setTimestamp(timestamp);
459
		}
483
		}
460
		file.setTimestamp(fResolver.getLastModified(location));
461
		file.setScannerConfigurationHashcode(configHash);
484
		file.setScannerConfigurationHashcode(configHash);
462
		Symbols lists= symbolMap.get(location);
485
		Symbols lists= symbolMap.get(location);
463
		if (lists != null) {
486
		if (lists != null) {
Lines 481-488 Link Here
481
						(contextIncludes.contains(include) || clearedContexts.contains(info.fLocation));
504
						(contextIncludes.contains(include) || clearedContexts.contains(info.fLocation));
482
				}
505
				}
483
			}
506
			}
484
			index.setFileContent(file, linkageID, includeInfos, macros, names, fResolver);
507
			index.setFileContent(file, linkageID, includeInfos, macros, names, fResolver,
508
					FINE_GRAINED_LOCKING ? lock : null);
485
		}
509
		}
510
		if (FINE_GRAINED_LOCKING) {
511
			file.setTimestamp(timestamp);
512
			file = index.commitUncommittedFile();
513
		}			
486
		return file;
514
		return file;
487
	}
515
	}
488
	
516
	
(-)parser/org/eclipse/cdt/internal/core/pdom/WritablePDOM.java (-5 / +63 lines)
Lines 25-41 Link Here
25
import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
25
import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
26
import org.eclipse.cdt.internal.core.index.IWritableIndexFragment;
26
import org.eclipse.cdt.internal.core.index.IWritableIndexFragment;
27
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
27
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
28
import org.eclipse.cdt.internal.core.pdom.db.BTree;
28
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
29
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
29
import org.eclipse.cdt.internal.core.pdom.db.DBProperties;
30
import org.eclipse.cdt.internal.core.pdom.db.DBProperties;
30
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
31
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
31
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
32
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
33
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
32
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
34
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
35
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
36
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
33
import org.eclipse.core.runtime.CoreException;
37
import org.eclipse.core.runtime.CoreException;
34
38
35
public class WritablePDOM extends PDOM implements IWritableIndexFragment {	
39
public class WritablePDOM extends PDOM implements IWritableIndexFragment {	
36
	private boolean fClearedBecauseOfVersionMismatch= false;
40
	private boolean fClearedBecauseOfVersionMismatch= false;
37
	private boolean fCreatedFromScratch= false;
41
	private boolean fCreatedFromScratch= false;
38
	private ASTFilePathResolver fPathResolver;
42
	private ASTFilePathResolver fPathResolver;
43
	private PDOMFile fileBeingUpdated;
44
	private PDOMFile uncommittedFile;
45
	private IIndexFileLocation uncommittedLocation;
39
46
40
	public WritablePDOM(File dbPath, IIndexLocationConverter locationConverter, Map<String, IPDOMLinkageFactory> linkageFactoryMappings) throws CoreException {
47
	public WritablePDOM(File dbPath, IIndexLocationConverter locationConverter, Map<String, IPDOMLinkageFactory> linkageFactoryMappings) throws CoreException {
41
		this(dbPath, locationConverter, ChunkCache.getSharedInstance(), linkageFactoryMappings);
48
		this(dbPath, locationConverter, ChunkCache.getSharedInstance(), linkageFactoryMappings);
Lines 51-61 Link Here
51
58
52
	@Override
59
	@Override
53
	public IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location) throws CoreException {
60
	public IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location) throws CoreException {
61
		if (uncommittedLocation != null && uncommittedLocation.equals(location)) {
62
			return uncommittedFile;
63
		}
54
		return super.addFile(linkageID, location);
64
		return super.addFile(linkageID, location);
55
	}
65
	}
56
66
67
	public IIndexFragmentFile addUncommittedFile(int linkageID, IIndexFileLocation location) throws CoreException {
68
		uncommittedLocation = location;
69
		fileBeingUpdated = getFile(linkageID, uncommittedLocation);
70
		PDOMLinkage linkage= createLinkage(linkageID);
71
		uncommittedFile = new PDOMFile(linkage, location, linkageID); //XXX Experiment
72
		return uncommittedFile;
73
	}
74
75
	public IIndexFragmentFile commitUncommittedFile() throws CoreException {
76
		if (uncommittedFile == null)
77
			return null;
78
		IIndexFragmentFile file;
79
		if (fileBeingUpdated == null) {
80
			// New file.
81
			BTree fileIndex = getFileIndex();
82
			fileIndex.insert(uncommittedFile.getRecord());
83
			file = uncommittedFile;
84
		} else {
85
			// Existing file.
86
			fileBeingUpdated.replaceContentsFrom(uncommittedFile);
87
			file = fileBeingUpdated;
88
			fileBeingUpdated = null;
89
		}
90
		fEvent.fFilesWritten.add(uncommittedLocation);
91
		uncommittedFile = null;
92
		uncommittedLocation = null;
93
		return file;
94
	}
95
57
	public void addFileContent(IIndexFragmentFile sourceFile, IncludeInformation[] includes, 
96
	public void addFileContent(IIndexFragmentFile sourceFile, IncludeInformation[] includes, 
58
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver pathResolver) throws CoreException {
97
			IASTPreprocessorStatement[] macros, IASTName[][] names, ASTFilePathResolver pathResolver,
98
			YieldableIndexLock lock) throws CoreException, InterruptedException {
59
		assert sourceFile.getIndexFragment() == this;
99
		assert sourceFile.getIndexFragment() == this;
60
		
100
		
61
		PDOMFile pdomFile = (PDOMFile) sourceFile;
101
		PDOMFile pdomFile = (PDOMFile) sourceFile;
Lines 64-77 Link Here
64
		final ASTFilePathResolver origResolver= fPathResolver;
104
		final ASTFilePathResolver origResolver= fPathResolver;
65
		fPathResolver= pathResolver;
105
		fPathResolver= pathResolver;
66
		try {
106
		try {
67
			pdomFile.addNames(names);
107
			pdomFile.addNames(names, lock);
68
		} finally {
108
		} finally {
69
			fPathResolver= origResolver;
109
			fPathResolver= origResolver;
70
		}
110
		}
71
		
111
		
72
		final IIndexFileLocation location = pdomFile.getLocation();
112
		final IIndexFileLocation location = pdomFile.getLocation();
73
		fEvent.fClearedFiles.remove(location);
113
		if (location != null) {
74
		fEvent.fFilesWritten.add(location);
114
			fEvent.fClearedFiles.remove(location);
115
			fEvent.fFilesWritten.add(location);
116
		}
75
	}
117
	}
76
118
77
	public void clearFile(IIndexFragmentFile file, Collection<IIndexFileLocation> contextsRemoved) throws CoreException {
119
	public void clearFile(IIndexFragmentFile file, Collection<IIndexFileLocation> contextsRemoved) throws CoreException {
Lines 168-178 Link Here
168
210
169
	public PDOMFile getFileForASTPath(int linkageID, String astPath) throws CoreException {
211
	public PDOMFile getFileForASTPath(int linkageID, String astPath) throws CoreException {
170
		if (fPathResolver != null && astPath != null) {
212
		if (fPathResolver != null && astPath != null) {
171
			return getFile(linkageID, fPathResolver.resolveASTPath(astPath));
213
			IIndexFileLocation location = fPathResolver.resolveASTPath(astPath);
214
			if (location.equals(uncommittedLocation))
215
				return fileBeingUpdated != null ? fileBeingUpdated : uncommittedFile;
216
			return getFile(linkageID, location);
172
		}
217
		}
173
		return null;
218
		return null;
174
	}
219
	}
175
220
221
	@Override
222
	public boolean hasLastingDefinition(PDOMBinding binding) throws CoreException {
223
		if (uncommittedFile == null) {
224
			return binding.hasDefinition();
225
		}
226
		for (PDOMName name = binding.getFirstDefinition(); name != null; name = name.getNextInBinding()) {
227
			if (!uncommittedFile.equals(name.getFile())) {
228
				return true;
229
			}
230
		}
231
		return false;
232
	}
233
	
176
	/* (non-Javadoc)
234
	/* (non-Javadoc)
177
	 * @see org.eclipse.cdt.internal.core.index.IWritableIndexFragment#getDatabaseSizeBytes()
235
	 * @see org.eclipse.cdt.internal.core.index.IWritableIndexFragment#getDatabaseSizeBytes()
178
	 */
236
	 */
(-)parser/org/eclipse/cdt/internal/core/pdom/YieldableIndexLock.java (+73 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Google, Inc and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * 	  Sergey Prigogin (Google) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.internal.core.pdom;
12
13
import org.eclipse.cdt.internal.core.index.IWritableIndex;
14
15
public class YieldableIndexLock {
16
	// Minimum interval between yields in milliseconds.
17
	private static final long YIELD_INTERVAL = 1000;
18
	
19
	private final IWritableIndex index;
20
	private final int readlockCount;
21
	private final boolean flushIndex;
22
	private long lastLockTime;
23
	private long cumulativeLockTime;
24
25
	public YieldableIndexLock(IWritableIndex index, int readlockCount, boolean flushIndex) {
26
		this.index = index;
27
		this.readlockCount = readlockCount;
28
		this.flushIndex = flushIndex;
29
	}
30
31
	/**
32
	 * Acquires the lock.
33
	 * 
34
	 * @throws InterruptedException
35
	 */
36
	public void acquire() throws InterruptedException {
37
		index.acquireWriteLock(readlockCount);
38
		lastLockTime = System.currentTimeMillis();
39
	}
40
41
	/**
42
	 * Releases the lock.
43
	 */
44
	public void release() {
45
		if (lastLockTime != 0) {
46
			index.releaseWriteLock(readlockCount, flushIndex);
47
			cumulativeLockTime += System.currentTimeMillis() - lastLockTime;
48
			lastLockTime = 0;
49
		}
50
	}
51
52
	/**
53
	 * Yields the lock temporarily if it was held for YIELD_INTERVAL or more.
54
	 * @throws InterruptedException
55
	 */
56
	public void yield() throws InterruptedException {
57
		if (index.hasWaitingReaders()) {
58
			long t = System.currentTimeMillis() - lastLockTime;
59
			if (t >= YIELD_INTERVAL) {
60
				index.releaseWriteLock(readlockCount, false);
61
				cumulativeLockTime += t;
62
				acquire();
63
			}
64
		}
65
	}
66
67
	/**
68
	 * @return Total time the lock was held in milliseconds. 
69
	 */
70
	public long getCumulativeLockTime() {
71
		return cumulativeLockTime;
72
	}
73
}
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java (-5 / +112 lines)
Lines 30-35 Link Here
30
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
30
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
31
import org.eclipse.cdt.core.dom.ast.IParameter;
31
import org.eclipse.cdt.core.dom.ast.IParameter;
32
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
32
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
33
import org.eclipse.cdt.core.index.IIndexFile;
33
import org.eclipse.cdt.core.index.IIndexFileLocation;
34
import org.eclipse.cdt.core.index.IIndexFileLocation;
34
import org.eclipse.cdt.core.index.IIndexInclude;
35
import org.eclipse.cdt.core.index.IIndexInclude;
35
import org.eclipse.cdt.core.index.IIndexLocationConverter;
36
import org.eclipse.cdt.core.index.IIndexLocationConverter;
Lines 42-47 Link Here
42
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
43
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
43
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
44
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
44
import org.eclipse.cdt.internal.core.pdom.PDOM;
45
import org.eclipse.cdt.internal.core.pdom.PDOM;
46
import org.eclipse.cdt.internal.core.pdom.YieldableIndexLock;
45
import org.eclipse.cdt.internal.core.pdom.db.BTree;
47
import org.eclipse.cdt.internal.core.pdom.db.BTree;
46
import org.eclipse.cdt.internal.core.pdom.db.Database;
48
import org.eclipse.cdt.internal.core.pdom.db.Database;
47
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
49
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
Lines 136-144 Link Here
136
	}
138
	}
137
	
139
	
138
	/**
140
	/**
139
	 * Directly changes this record's internal location string. The format
141
	 * Transfers names, macros and includes from another file to this one and deletes the other file.
140
	 * of this string is unspecified in general and is determined by the 
142
	 * @param sourceFile the file to transfer the local bindings from.
141
	 * associated IIndexLocationConverter
143
	 * @throws CoreException
144
	 */
145
	public void replaceContentsFrom(PDOMFile sourceFile) throws CoreException {
146
		ICPPUsingDirective[] directives= getUsingDirectives();
147
		for (ICPPUsingDirective ud : directives) {
148
			if (ud instanceof IPDOMNode) {
149
				((IPDOMNode) ud).delete(null);
150
			}
151
		}
152
		setFirstUsingDirectiveRec(sourceFile.getLastUsingDirectiveRec());
153
154
		// Replace the includes
155
		PDOMInclude include = getFirstInclude();
156
		while (include != null) {
157
			PDOMInclude nextInclude = include.getNextInIncludes();
158
			IIndexFile includedBy = include.getIncludedBy();
159
			if (includedBy.equals(this)) {
160
				include.delete();
161
			}
162
			include = nextInclude;
163
		}
164
		include = sourceFile.getFirstInclude();
165
		setFirstInclude(include);
166
		while (include != null) {
167
			IIndexFile includedBy = include.getIncludedBy();
168
			if (includedBy.equals(sourceFile)) {
169
				include.setIncludedBy(this);
170
			}
171
			include = include.getNextInIncludes();
172
		}
173
174
		include = sourceFile.getFirstIncludedBy();
175
		setFirstIncludedBy(include);
176
		while (include != null) {
177
			include.setIncludes(this);
178
			include = include.getNextInIncludedBy();
179
		}
180
181
		// Replace all the macros in this file.
182
		PDOMLinkage linkage= getLinkage();
183
		PDOMMacro macro = getFirstMacro();
184
		while (macro != null) {
185
			PDOMMacro nextMacro = macro.getNextMacro();
186
			macro.delete(linkage);
187
			macro = nextMacro;
188
		}
189
		setFirstMacro(sourceFile.getFirstMacro());
190
191
		// Replace all macro references
192
		ArrayList<PDOMMacroReferenceName> mrefs= new ArrayList<PDOMMacroReferenceName>();
193
		PDOMMacroReferenceName mref = getFirstMacroReference();
194
		while (mref != null) {
195
			mrefs.add(mref);
196
			mref= mref.getNextInFile();
197
		}
198
		for (PDOMMacroReferenceName m : mrefs) {
199
			m.delete();
200
		}
201
		setFirstMacroReference(sourceFile.getFirstMacroReference());
202
203
		// Replace all the names in this file
204
		ArrayList<PDOMName> names= new ArrayList<PDOMName>();
205
		PDOMName name = getFirstName();
206
		while (name != null) {
207
			names.add(name);
208
			linkage.onDeleteName(name);
209
			name= name.getNextInFile();
210
		}
211
		for (Iterator<PDOMName> iterator = names.iterator(); iterator.hasNext();) {
212
			name = iterator.next();
213
			name.delete();
214
		}
215
		setFirstName(sourceFile.getFirstName());
216
217
		setTimestamp(sourceFile.getTimestamp());
218
		setScannerConfigurationHashcode(sourceFile.getScannerConfigurationHashcode());
219
220
		sourceFile.delete();
221
	}
222
223
	/**
224
	 * This method should not be called on PDOMFile objects that are referenced by the file index.
225
	 * @param location a new location
226
	 * @throws CoreException
227
	 */
228
	public void setLocation(IIndexFileLocation location) throws CoreException {
229
		String locationString = fLinkage.getPDOM().getLocationConverter().toInternalFormat(location);
230
		if (locationString == null)
231
			throw new CoreException(CCorePlugin.createStatus(Messages.getString("PDOMFile.toInternalProblem") + //$NON-NLS-1$
232
					location.getURI()));
233
		setInternalLocation(locationString);
234
	}
235
236
	/**
237
	 * Directly changes this record's internal location string. The format of this string is unspecified
238
	 * in general and is determined by the associated IIndexLocationConverter.
239
	 * This method should not be called on PDOMFile objects that are referenced by the file index.
142
	 * @param internalLocation
240
	 * @param internalLocation
143
	 * @throws CoreException
241
	 * @throws CoreException
144
	 */
242
	 */
Lines 260-274 Link Here
260
		return fLinkage;
358
		return fLinkage;
261
	}
359
	}
262
360
263
	public void addNames(IASTName[][] names) throws CoreException {
361
	public void addNames(IASTName[][] names, YieldableIndexLock lock) throws CoreException, InterruptedException {
264
		assert getFirstName() == null;
362
		assert getFirstName() == null;
265
		assert getFirstMacroReference() == null;
363
		assert getFirstMacroReference() == null;
266
		final PDOMLinkage linkage= getLinkage();
364
		final PDOMLinkage linkage= getLinkage();
267
		HashMap<IASTName, PDOMName> nameCache= new HashMap<IASTName, PDOMName>();
365
		HashMap<IASTName, PDOMName> nameCache= new HashMap<IASTName, PDOMName>();
268
		PDOMName lastName= null;
366
		PDOMName lastName= null;
269
		PDOMMacroReferenceName lastMacroName= null;
367
		PDOMMacroReferenceName lastMacroName= null;
368
		int counter = 0;
270
		for (IASTName[] name : names) {
369
		for (IASTName[] name : names) {
271
			if (name[0] != null) {
370
			if (name[0] != null) {
371
				if (lock != null && ++counter >= 1000) {
372
					counter = 0;
373
					lock.yield();
374
				}
272
				PDOMName caller= nameCache.get(name[1]);
375
				PDOMName caller= nameCache.get(name[1]);
273
				IIndexFragmentName fname= createPDOMName(linkage, name[0], caller);
376
				IIndexFragmentName fname= createPDOMName(linkage, name[0], caller);
274
				if (fname instanceof PDOMName) {
377
				if (fname instanceof PDOMName) {
Lines 344-350 Link Here
344
			include.delete();
447
			include.delete();
345
			include = nextInclude;
448
			include = nextInclude;
346
		}
449
		}
347
		setFirstInclude(include);
450
		setFirstInclude(null);
348
451
349
		// Delete all the macros in this file
452
		// Delete all the macros in this file
350
		PDOMLinkage linkage= getLinkage();
453
		PDOMLinkage linkage= getLinkage();
Lines 385-390 Link Here
385
		setTimestamp(-1);
488
		setTimestamp(-1);
386
	}
489
	}
387
490
491
	private void delete() throws CoreException {
492
		fLinkage.getDB().free(record);
493
	}
494
388
	public void addIncludesTo(IncludeInformation[] includeInfos) throws CoreException {
495
	public void addIncludesTo(IncludeInformation[] includeInfos) throws CoreException {
389
		assert getFirstInclude() == null;
496
		assert getFirstInclude() == null;
390
497
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java (-1 / +6 lines)
Lines 141-146 Link Here
141
		return rec != 0 ? new PDOMFile(linkage, rec) : null;
141
		return rec != 0 ? new PDOMFile(linkage, rec) : null;
142
	}
142
	}
143
143
144
	void setIncludes(PDOMFile includedFile) throws CoreException {
145
		long rec = includedFile != null ? includedFile.getRecord() : 0;
146
		linkage.getDB().putRecPtr(record + INCLUDED_FILE, rec);
147
	}
148
144
	/**
149
	/**
145
	 * Checks if the name is the same as the end part of the path of the included file.
150
	 * Checks if the name is the same as the end part of the path of the included file.
146
	 */
151
	 */
Lines 166-172 Link Here
166
		return rec != 0 ? new PDOMFile(linkage, rec) : null;
171
		return rec != 0 ? new PDOMFile(linkage, rec) : null;
167
	}
172
	}
168
173
169
	private void setIncludedBy(PDOMFile includedBy) throws CoreException {
174
	void setIncludedBy(PDOMFile includedBy) throws CoreException {
170
		long rec = includedBy != null ? includedBy.getRecord() : 0;
175
		long rec = includedBy != null ? includedBy.getRecord() : 0;
171
		linkage.getDB().putRecPtr(record + INCLUDED_BY, rec);
176
		linkage.getDB().putRecPtr(record + INCLUDED_BY, rec);
172
	}
177
	}
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java (-3 / +3 lines)
Lines 299-305 Link Here
299
			if (fromName.isDefinition()) {
299
			if (fromName.isDefinition()) {
300
				return true;
300
				return true;
301
			}
301
			}
302
			return !pdomBinding.hasDefinition();
302
			return !getPDOM().hasLastingDefinition(pdomBinding);
303
		}
303
		}
304
		return false;
304
		return false;
305
	}
305
	}
Lines 444-451 Link Here
444
					if (!(method instanceof IProblemBinding)) {
444
					if (!(method instanceof IProblemBinding)) {
445
						PDOMBinding pdomBinding= adaptBinding(method);
445
						PDOMBinding pdomBinding= adaptBinding(method);
446
						if (pdomBinding == null) {
446
						if (pdomBinding == null) {
447
							createBinding(type, method, fileLocalRec);
447
							pdomBinding = createBinding(type, method, fileLocalRec);
448
						} else if (!pdomBinding.hasDefinition()) {
448
						} else if (!getPDOM().hasLastingDefinition(pdomBinding)) {
449
							pdomBinding.update(this, method);
449
							pdomBinding.update(this, method);
450
						}
450
						}
451
					}
451
					}
(-)parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java (+5 lines)
Lines 123-128 Link Here
123
	}
123
	}
124
124
125
	public void releaseReadLock() {}
125
	public void releaseReadLock() {}
126
127
	public boolean hasWaitingReaders() {
128
		return false;
129
	}
130
126
	public void resetCacheCounters() {}
131
	public void resetCacheCounters() {}
127
132
128
	public IIndexFragmentFileSet createFileSet() {
133
	public IIndexFragmentFileSet createFileSet() {

Return to bug 287907