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

Adding files to the index: Use same order for full and fast indexer.

This commit is contained in:
Markus Schorn 2006-11-14 13:09:16 +00:00
parent e3c77133d7
commit b2439b77c8

View file

@ -140,6 +140,7 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
protected void addSymbols(IASTTranslationUnit ast, IProgressMonitor pm) throws InterruptedException, CoreException {
// Add in the includes
final LinkedHashMap symbolMap= new LinkedHashMap(); // makes bugs reproducible
prepareInMap(symbolMap, ast.getFilePath());
// includes
IASTPreprocessorIncludeStatement[] includes = ast.getIncludeDirectives();
@ -148,6 +149,10 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
IASTFileLocation sourceLoc = include.getFileLocation();
String path= sourceLoc != null ? sourceLoc.getFileName() : ast.getFilePath(); // command-line includes
addToMap(symbolMap, 0, path, include);
path= include.getPath();
if (path != null) {
prepareInMap(symbolMap, include.getPath());
}
}
// macros
@ -228,13 +233,18 @@ abstract class PDOMFullIndexerJob extends PDOMIndexerTask implements IPDOMIndexe
fCompletedSources++;
}
private void addToMap(HashMap map, int idx, String path, Object thing) {
private void prepareInMap(Map map, String path) {
if (filePathsToParse.get(path) != null) {
List[] lists= (List[]) map.get(path);
if (lists == null) {
lists= new ArrayList[]{new ArrayList(), new ArrayList(), new ArrayList()};
if (map.get(path) == null) {
Object lists= new ArrayList[]{new ArrayList(), new ArrayList(), new ArrayList()};
map.put(path, lists);
}
}
}
private void addToMap(HashMap map, int idx, String path, Object thing) {
List[] lists= (List[]) map.get(path);
if (lists != null) {
lists[idx].add(thing);
}
}