From 5bd41e38ba185cce2be40755f7bd99cdb8046fe0 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Wed, 25 Jul 2012 17:11:26 -0400 Subject: [PATCH] bug 385678: Juno Indexer cannot find headers in workspace folders that Indigo did find --- ...guageSettingsScannerInfoProviderTests.java | 11 +++++++-- .../LanguageSettingsScannerInfoProvider.java | 24 ++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java index de54edc6425..72ee4c50cfe 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java @@ -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 entries = new ArrayList(); 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); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsScannerInfoProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsScannerInfoProvider.java index b9d2201791b..fc782dc3ab5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsScannerInfoProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsScannerInfoProvider.java @@ -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 {