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

bug 385678: Juno Indexer cannot find headers in workspace folders that

Indigo did find
This commit is contained in:
Andrew Gvozdev 2012-07-25 17:11:26 -04:00
parent 03af322a6f
commit 5bd41e38ba
2 changed files with 25 additions and 10 deletions

View file

@ -458,6 +458,10 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
// "relative" should make no difference for VALUE_WORKSPACE_PATH
IPath incWorkspaceRelativePath_3 = incWorkspace_3.getFullPath().makeRelative();
IPath incWorkspaceLocation_3 = incWorkspace_3.getLocation();
// not having "RESOLVED" should make no difference for well formed path
IFolder incWorkspace_4 = ResourceHelper.createFolder(project, "include_4");
IPath incWorkspacePathNoResolved_4 = incWorkspace_4.getFullPath();
IPath incWorkspaceLocation_4 = incWorkspace_4.getLocation();
// folder defined by absolute path on the filesystem
IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem");
@ -465,12 +469,14 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4, ICSettingEntry.VALUE_WORKSPACE_PATH);
CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
entries.add(incWorkspaceEntry_1);
entries.add(incWorkspaceEntry_2);
entries.add(incWorkspaceEntry_3);
entries.add(incWorkspaceEntry_4);
entries.add(incFilesystemEntry);
// add provider to the configuration
@ -490,8 +496,9 @@ public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
assertEquals(incWorkspaceLocation_1, new Path(actualIncludePaths[0]));
assertEquals(incWorkspaceLocation_2, new Path(actualIncludePaths[1]));
assertEquals(incWorkspaceLocation_3, new Path(actualIncludePaths[2]));
assertEquals(incFilesystem, new Path(actualIncludePaths[3]));
assertEquals(4, actualIncludePaths.length);
assertEquals(incWorkspaceLocation_4, new Path(actualIncludePaths[3]));
assertEquals(incFilesystem, new Path(actualIncludePaths[4]));
assertEquals(5, actualIncludePaths.length);
}

View file

@ -36,6 +36,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
import org.eclipse.core.resources.IProject;
@ -221,14 +222,21 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
for (ICLanguageSettingEntry entry : entriesPath) {
ACPathEntry entryPath = (ACPathEntry)entry;
if (entryPath.isValueWorkspacePath()) {
IPath loc = entryPath.getLocation();
if (loc!=null) {
if (checkBit(entryPath.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
// handle frameworks, see IScannerInfo.getIncludePaths()
locations.add(loc.append(FRAMEWORK_HEADERS_INCLUDE).toOSString());
locations.add(loc.append(FRAMEWORK_PRIVATE_HEADERS_INCLUDE).toOSString());
} else {
locations.add(loc.toOSString());
ICLanguageSettingEntry[] entries = new ICLanguageSettingEntry[] {entry};
if (!entry.isResolved()) {
entries = CDataUtil.resolveEntries(entries, cfgDescription);
}
for (ICLanguageSettingEntry resolved : entries) {
IPath loc = ((ACPathEntry) resolved).getLocation();
if (loc != null) {
if (checkBit(resolved.getFlags(), ICSettingEntry.FRAMEWORKS_MAC)) {
// handle frameworks, see IScannerInfo.getIncludePaths()
locations.add(loc.append(FRAMEWORK_HEADERS_INCLUDE).toOSString());
locations.add(loc.append(FRAMEWORK_PRIVATE_HEADERS_INCLUDE).toOSString());
} else {
locations.add(loc.toOSString());
}
}
}
} else {