mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
Removal of old file cache from DOMScanner.
This commit is contained in:
parent
8b59056395
commit
082daae88f
3 changed files with 36 additions and 24 deletions
|
@ -111,8 +111,6 @@ abstract class BaseScanner implements IScanner {
|
||||||
|
|
||||||
protected ExpressionEvaluator expressionEvaluator;
|
protected ExpressionEvaluator expressionEvaluator;
|
||||||
|
|
||||||
protected final CharArrayObjectMap fileCache = new CharArrayObjectMap(100);
|
|
||||||
|
|
||||||
// The context stack
|
// The context stack
|
||||||
protected static final int bufferInitialSize = 8;
|
protected static final int bufferInitialSize = 8;
|
||||||
|
|
||||||
|
@ -1226,9 +1224,6 @@ abstract class BaseScanner implements IScanner {
|
||||||
|
|
||||||
additionalKeywords = configuration.getAdditionalKeywords();
|
additionalKeywords = configuration.getAdditionalKeywords();
|
||||||
|
|
||||||
if (reader.filename != null)
|
|
||||||
fileCache.put(reader.filename, reader);
|
|
||||||
|
|
||||||
setupBuiltInMacros(configuration);
|
setupBuiltInMacros(configuration);
|
||||||
|
|
||||||
if (info.getDefinedSymbols() != null) {
|
if (info.getDefinedSymbols() != null) {
|
||||||
|
@ -2865,25 +2860,8 @@ abstract class BaseScanner implements IScanner {
|
||||||
fileNameArray);
|
fileNameArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CodeReader createReader(String path, String fileName) {
|
protected abstract CodeReader createReader(String path, String fileName);
|
||||||
String finalPath = ScannerUtility.createReconciledPath(path, fileName);
|
|
||||||
char[] finalPathc = finalPath.toCharArray();
|
|
||||||
CodeReader reader = (CodeReader) fileCache.get(finalPathc);
|
|
||||||
if (reader != null)
|
|
||||||
return reader; // found the file in the cache
|
|
||||||
|
|
||||||
// create a new reader on this file (if the file does not exist we will
|
|
||||||
// get null)
|
|
||||||
reader = createReaderDuple(finalPath);
|
|
||||||
if (reader == null)
|
|
||||||
return null; // the file was not found
|
|
||||||
|
|
||||||
if (reader.filename != null)
|
|
||||||
// put the full requested path in the cache -- it is more likely
|
|
||||||
// to match next time than the reader.filename
|
|
||||||
fileCache.put(finalPathc, reader);
|
|
||||||
return reader;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int findIncludePos(String[] paths, File currentDirectory) {
|
private int findIncludePos(String[] paths, File currentDirectory) {
|
||||||
for (int i = 0; i < paths.length; ++i)
|
for (int i = 0; i < paths.length; ++i)
|
||||||
|
|
|
@ -446,4 +446,11 @@ public class DOMScanner extends BaseScanner {
|
||||||
protected void afterReplaceAllMacros() {
|
protected void afterReplaceAllMacros() {
|
||||||
--fsmCount;
|
--fsmCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CodeReader createReader(String path, String fileName){
|
||||||
|
String finalPath = ScannerUtility.createReconciledPath(path, fileName);
|
||||||
|
CodeReader reader = createReaderDuple(finalPath);
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.parser.ParserFactory;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.parser.ParserMode;
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
|
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
|
||||||
import org.eclipse.cdt.internal.core.parser.token.ImagedExpansionToken;
|
import org.eclipse.cdt.internal.core.parser.token.ImagedExpansionToken;
|
||||||
import org.eclipse.cdt.internal.core.parser.token.ImagedToken;
|
import org.eclipse.cdt.internal.core.parser.token.ImagedToken;
|
||||||
|
@ -54,6 +55,9 @@ public class Scanner2 extends BaseScanner {
|
||||||
this.expressionEvaluator = new ExpressionEvaluator(callbackManager, spf);
|
this.expressionEvaluator = new ExpressionEvaluator(callbackManager, spf);
|
||||||
this.workingCopies = workingCopies;
|
this.workingCopies = workingCopies;
|
||||||
postConstructorSetup(reader, info);
|
postConstructorSetup(reader, info);
|
||||||
|
if (reader.filename != null)
|
||||||
|
fileCache.put(reader.filename, reader);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -225,6 +229,8 @@ public class Scanner2 extends BaseScanner {
|
||||||
|
|
||||||
protected static final ScannerProblemFactory spf = new ScannerProblemFactory();
|
protected static final ScannerProblemFactory spf = new ScannerProblemFactory();
|
||||||
|
|
||||||
|
protected final CharArrayObjectMap fileCache = new CharArrayObjectMap(100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -331,5 +337,26 @@ public class Scanner2 extends BaseScanner {
|
||||||
*/
|
*/
|
||||||
protected void processPragma(int startPos, int endPos) {
|
protected void processPragma(int startPos, int endPos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CodeReader createReader(String path, String fileName){
|
||||||
|
String finalPath = ScannerUtility.createReconciledPath(path, fileName);
|
||||||
|
char[] finalPathc = finalPath.toCharArray();
|
||||||
|
CodeReader reader = (CodeReader) fileCache.get(finalPathc);
|
||||||
|
if (reader != null)
|
||||||
|
return reader; // found the file in the cache
|
||||||
|
|
||||||
|
// create a new reader on this file (if the file does not exist we will
|
||||||
|
// get null)
|
||||||
|
reader = createReaderDuple(finalPath);
|
||||||
|
if (reader == null)
|
||||||
|
return null; // the file was not found
|
||||||
|
|
||||||
|
if (reader.filename != null)
|
||||||
|
// put the full requested path in the cache -- it is more likely
|
||||||
|
// to match next time than the reader.filename
|
||||||
|
fileCache.put(finalPathc, reader);
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue