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

Fix for PR 91405: Search does not find declarations of printf

Index entries form include files external to workspace were erroneously stored under compilation unit's file id.
This commit is contained in:
Vladimir Hirsl 2005-04-15 12:48:52 +00:00
parent 6df8a731ad
commit f9a0362d08
3 changed files with 13 additions and 20 deletions

View file

@ -1,3 +1,11 @@
2005-04-15 Vladimir Hirsl
Fix for PR 91405: Search does not find declarations of printf
Index entries form include files external to workspace were erroneously stored
under compilation unit's file id.
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java
* index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRequestor.java
2005-04-11 Vladimir Hirsl 2005-04-11 Vladimir Hirsl
Fix for PR 90193: Scanner faililng on Local/User paths as provided in Std. Make Fix for PR 90193: Scanner faililng on Local/User paths as provided in Std. Make
User specified include paths (through the UI) are now created with User specified include paths (through the UI) are now created with

View file

@ -87,36 +87,26 @@ public class IndexEncoderUtil {
String filePath = ""; //$NON-NLS-1$ String filePath = ""; //$NON-NLS-1$
if (tempFile != null){ if (tempFile != null){
//File is local to workspace //File is local to workspace
filePath = tempFile.getFullPath().toString(); filePath = tempFile.getFullPath().toOSString();
} }
else { else {
//File is external to workspace //File is external to workspace
IFile[] externalFiles = CCorePlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName));
if (externalFiles.length > 0)
tempFile = externalFiles[0];
filePath = fileName; filePath = fileName;
} }
if (tempFile != null && !tempFile.equals(indexer.getResourceFile())) { if (!filePath.equals(indexer.getResourceFile().getFullPath().toOSString())) {
//We are not in the file that has triggered the index. Thus, we need to find the //We are not in the file that has triggered the index. Thus, we need to find the
//file number for the current file (if it has one). If the current file does not //file number for the current file (if it has one). If the current file does not
//have a file number, we need to add it to the index. //have a file number, we need to add it to the index.
IndexedFileEntry indFile = indexer.getOutput().getIndexedFile(filePath); IndexedFileEntry indFile = indexer.getOutput().getIndexedFile(filePath);
if (indFile != null){ if (indFile != null) {
fileNum = indFile.getFileID(); fileNum = indFile.getFileID();
} }
else { else {
//Need to add file to index //Need to add file to index
if (tempFile != null){ indFile = indexer.getOutput().addIndexedFile(filePath);
indFile = indexer.getOutput().addIndexedFile(tempFile.getFullPath().toString());
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileID(); fileNum = indFile.getFileID();
}
else {
indFile = indexer.getOutput().addIndexedFile(fileName);
if (indFile != null)
fileNum = indFile.getFileID();
}
} }
} }
} }

View file

@ -302,12 +302,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
else { else {
//Need to add file to index and get a fileNumber //Need to add file to index and get a fileNumber
if (tempFile != null){ if (tempFile != null){
indFile = indexer.output.addIndexedFile(tempFile.getFullPath().toString()); indFile = indexer.output.addIndexedFile(filePath);
if (indFile != null)
fileNum = indFile.getFileID();
}
else {
indFile = indexer.output.addIndexedFile(include.getFullFileName());
if (indFile != null) if (indFile != null)
fileNum = indFile.getFileID(); fileNum = indFile.getFileID();
} }