mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
[281415] StandaloneIndexerInputAdapter.resolveIncludeFile() does not check that the include file exists
This commit is contained in:
parent
c6d196e720
commit
e6cc7c220e
1 changed files with 8 additions and 3 deletions
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
|
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
|
||||||
import org.eclipse.cdt.internal.core.pdom.IndexerInputAdapter;
|
import org.eclipse.cdt.internal.core.pdom.IndexerInputAdapter;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.indexer.FileExistsCache;
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -30,7 +31,8 @@ import org.eclipse.core.runtime.Path;
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
private HashMap<String, IIndexFileLocation> fIflCache= new HashMap<String, IIndexFileLocation>();
|
private final HashMap<String, IIndexFileLocation> fIflCache= new HashMap<String, IIndexFileLocation>();
|
||||||
|
private final FileExistsCache fExistsCache = new FileExistsCache();
|
||||||
|
|
||||||
private final StandaloneIndexer fIndexer;
|
private final StandaloneIndexer fIndexer;
|
||||||
|
|
||||||
|
@ -87,11 +89,14 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesIncludeFileExist(String includePath) {
|
public boolean doesIncludeFileExist(String includePath) {
|
||||||
return new File(includePath).isFile();
|
return fExistsCache.isFile(includePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFileLocation resolveIncludeFile(String includePath) {
|
public IIndexFileLocation resolveIncludeFile(String includePath) {
|
||||||
|
if (!fExistsCache.isFile(includePath)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
IIndexFileLocation result= fIflCache.get(includePath);
|
IIndexFileLocation result= fIflCache.get(includePath);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
File file= new File(includePath);
|
File file= new File(includePath);
|
||||||
|
|
Loading…
Add table
Reference in a new issue