From f9a0362d08f2debe6e2d88793b23b1dab15af08b Mon Sep 17 00:00:00 2001 From: Vladimir Hirsl Date: Fri, 15 Apr 2005 12:48:52 +0000 Subject: [PATCH] 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. --- core/org.eclipse.cdt.core/ChangeLog | 8 ++++++++ .../domsourceindexer/IndexEncoderUtil.java | 18 ++++-------------- .../sourceindexer/SourceIndexerRequestor.java | 7 +------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 948f9b1cde4..5a29df6183d 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -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 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 diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java index b51b9b80c15..70a56dfa065 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java @@ -87,36 +87,26 @@ public class IndexEncoderUtil { String filePath = ""; //$NON-NLS-1$ if (tempFile != null){ //File is local to workspace - filePath = tempFile.getFullPath().toString(); + filePath = tempFile.getFullPath().toOSString(); } else { //File is external to workspace - IFile[] externalFiles = CCorePlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName)); - if (externalFiles.length > 0) - tempFile = externalFiles[0]; 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 //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. IndexedFileEntry indFile = indexer.getOutput().getIndexedFile(filePath); - if (indFile != null){ + if (indFile != null) { fileNum = indFile.getFileID(); } else { //Need to add file to index - if (tempFile != null){ - indFile = indexer.getOutput().addIndexedFile(tempFile.getFullPath().toString()); + indFile = indexer.getOutput().addIndexedFile(filePath); if (indFile != null) fileNum = indFile.getFileID(); - } - else { - indFile = indexer.getOutput().addIndexedFile(fileName); - if (indFile != null) - fileNum = indFile.getFileID(); - } } } } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRequestor.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRequestor.java index 246bf4b7af9..59815661f30 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRequestor.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/sourceindexer/SourceIndexerRequestor.java @@ -302,12 +302,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo else { //Need to add file to index and get a fileNumber if (tempFile != null){ - indFile = indexer.output.addIndexedFile(tempFile.getFullPath().toString()); - if (indFile != null) - fileNum = indFile.getFileID(); - } - else { - indFile = indexer.output.addIndexedFile(include.getFullFileName()); + indFile = indexer.output.addIndexedFile(filePath); if (indFile != null) fileNum = indFile.getFileID(); }