1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Add assertions to check that macro definitions are not reused after updating a file in the index.

This commit is contained in:
Markus Schorn 2007-06-06 12:57:37 +00:00
parent b46612d412
commit 3091857bf1
2 changed files with 8 additions and 2 deletions

View file

@ -61,6 +61,10 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
public IIndexFile fFile= null;
public int fRequested= 0;
public boolean hasCachedMacros() {
return fMacros != null;
}
}
private static class NeedToParseException extends Exception {
private static final long serialVersionUID = 1L;
@ -208,10 +212,11 @@ public class IndexBasedCodeReaderFactory implements ICodeReaderFactory {
}
private void getInfosForMacroDictionary(IndexFileInfo fileInfo, LinkedHashSet/*<FileInfo>*/ target) throws CoreException, NeedToParseException {
if (!target.add(fileInfo)) {
// in case the file is already included, don't load the macros again.
if (isIncluded(fileInfo)) {
return;
}
if (isIncluded(fileInfo)) {
if (!target.add(fileInfo)) {
return;
}
final IIndexFile file= fileInfo.fFile;

View file

@ -199,6 +199,7 @@ class PDOMFastIndexerTask extends PDOMIndexerTask implements CallbackHandler {
throws CoreException {
IndexFileInfo info= fCodeReaderFactory.createFileInfo(path);
info.fFile= file;
assert !info.hasCachedMacros();
if (info.fRequested != IndexFileInfo.NOT_REQUESTED) {
info.fRequested= IndexFileInfo.NOT_REQUESTED;
return true;