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