1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +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 IIndexFile fFile= null;
public int fRequested= 0; public int fRequested= 0;
public boolean hasCachedMacros() {
return fMacros != null;
}
} }
private static class NeedToParseException extends Exception { private static class NeedToParseException extends Exception {
private static final long serialVersionUID = 1L; 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 { 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; return;
} }
if (isIncluded(fileInfo)) { if (!target.add(fileInfo)) {
return; return;
} }
final IIndexFile file= fileInfo.fFile; final IIndexFile file= fileInfo.fFile;

View file

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