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

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-07-19 14:55:12 -04:00
commit 679bcb0a1a
32 changed files with 350 additions and 517 deletions

View file

@ -417,8 +417,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ {
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice()); CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0); CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue()); assertEquals(expected.getValue(), entry.getValue());
@ -469,46 +468,45 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file5, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file5, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file6, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file6, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file7, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file7, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file8, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file8, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file9, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file9, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file10, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file10, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
} }
@ -549,40 +547,18 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice());
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0); CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue()); assertEquals(expected.getValue(), entry.getValue());
assertEquals(expected.getKind(), entry.getKind()); assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags()); assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry); assertEquals(expected, entry);
}
{ assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
IPath path = new Path("/path1").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
CIncludePathEntry expected = new CIncludePathEntry(path, 0); assertEquals(new CIncludePathEntry("/path with spaces2", 0), entries.get(3));
CIncludePathEntry entry = (CIncludePathEntry)entries.get(1); assertEquals(new CIncludePathEntry("/path with spaces3", 0), entries.get(4));
assertEquals(expected, entry);
}
{
IPath path = new Path("/path with spaces").setDevice(project.getLocation().getDevice());
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
CIncludePathEntry entry = (CIncludePathEntry)entries.get(2);
assertEquals(expected, entry);
}
{
IPath path = new Path("/path with spaces2").setDevice(project.getLocation().getDevice());
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
CIncludePathEntry entry = (CIncludePathEntry)entries.get(3);
assertEquals(expected, entry);
}
{
IPath path = new Path("/path with spaces3").setDevice(project.getLocation().getDevice());
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
CIncludePathEntry entry = (CIncludePathEntry)entries.get(4);
assertEquals(expected, entry);
}
} }
/** /**
@ -616,18 +592,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ assertEquals(new CIncludePathEntry("/Framework", ICSettingEntry.FRAMEWORKS_MAC), entries.get(0));
IPath path = new Path("/Framework").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/framework/system", ICSettingEntry.FRAMEWORKS_MAC), entries.get(1));
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(0)); assertEquals(new CIncludePathEntry("/Framework with spaces", ICSettingEntry.FRAMEWORKS_MAC), entries.get(2));
}
{
IPath path = new Path("/framework/system").setDevice(project.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(1));
}
{
IPath path = new Path("/Framework with spaces").setDevice(project.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(2));
}
} }
/** /**
@ -663,7 +630,6 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
CMacroEntry expected = new CMacroEntry("MACRO0", "", 0); CMacroEntry expected = new CMacroEntry("MACRO0", "", 0);
CMacroEntry entry = (CMacroEntry)entries.get(0); CMacroEntry entry = (CMacroEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
@ -671,42 +637,14 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
assertEquals(expected.getKind(), entry.getKind()); assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags()); assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry); assertEquals(expected, entry);
}
{ assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(1));
CMacroEntry expected = new CMacroEntry("MACRO1", "value", 0); assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(2));
CMacroEntry entry = (CMacroEntry)entries.get(1); assertEquals(new CMacroEntry("MACRO3", "value with spaces", 0), entries.get(3));
assertEquals(expected, entry); assertEquals(new CMacroEntry("MACRO4", "\"quoted value\"", 0), entries.get(4));
} assertEquals(new CMacroEntry("MACRO5", "\"quoted value\"", 0), entries.get(5));
{ assertEquals(new CMacroEntry("MACRO6", "\"escape-quoted value\"", 0), entries.get(6));
CMacroEntry expected = new CMacroEntry("MACRO2", "value with spaces", 0); assertEquals(new CMacroEntry("MACRO7", "'single-quoted value'", 0), entries.get(7));
CMacroEntry entry = (CMacroEntry)entries.get(2);
assertEquals(expected, entry);
}
{
CMacroEntry expected = new CMacroEntry("MACRO3", "value with spaces", 0);
CMacroEntry entry = (CMacroEntry)entries.get(3);
assertEquals(expected, entry);
}
{
CMacroEntry expected = new CMacroEntry("MACRO4", "\"quoted value\"", 0);
CMacroEntry entry = (CMacroEntry)entries.get(4);
assertEquals(expected, entry);
}
{
CMacroEntry expected = new CMacroEntry("MACRO5", "\"quoted value\"", 0);
CMacroEntry entry = (CMacroEntry)entries.get(5);
assertEquals(expected, entry);
}
{
CMacroEntry expected = new CMacroEntry("MACRO6", "\"escape-quoted value\"", 0);
CMacroEntry entry = (CMacroEntry)entries.get(6);
assertEquals(expected, entry);
}
{
CMacroEntry expected = new CMacroEntry("MACRO7", "'single-quoted value'", 0);
CMacroEntry entry = (CMacroEntry)entries.get(7);
assertEquals(expected, entry);
}
} }
/** /**
@ -735,10 +673,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.UNDEFINED), entries.get(0)); assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.UNDEFINED), entries.get(0));
} }
}
/** /**
* Parse variations of -include options. * Parse variations of -include options.
@ -770,27 +706,19 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ CIncludeFileEntry expected = new CIncludeFileEntry("/include.file1", 0);
IPath incFile = new Path("/include.file1").setDevice(project.getLocation().getDevice());
CIncludeFileEntry expected = new CIncludeFileEntry(incFile, 0);
CIncludeFileEntry entry = (CIncludeFileEntry)entries.get(0); CIncludeFileEntry entry = (CIncludeFileEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue()); assertEquals(expected.getValue(), entry.getValue());
assertEquals(expected.getKind(), entry.getKind()); assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags()); assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry); assertEquals(expected, entry);
}
{ assertEquals(new CIncludeFileEntry("/include.file with spaces", 0), entries.get(1));
IPath incFile = new Path("/include.file with spaces").setDevice(project.getLocation().getDevice());
assertEquals(new CIncludeFileEntry(incFile, 0), entries.get(1));
}
{
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include.file2"), 0), entries.get(2)); assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include.file2"), 0), entries.get(2));
assertEquals(new CIncludeFileEntry(project.getFullPath().append("include.file3"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3)); assertEquals(new CIncludeFileEntry(project.getFullPath().append("include.file3"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include-file-with-dashes"), 0), entries.get(4)); assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include-file-with-dashes"), 0), entries.get(4));
} }
}
/** /**
* Parse variations of -macros options. * Parse variations of -macros options.
@ -820,22 +748,16 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ CMacroFileEntry expected = new CMacroFileEntry("/macro.file", 0);
IPath path = new Path("/macro.file").setDevice(project.getLocation().getDevice());
CMacroFileEntry expected = new CMacroFileEntry(path, 0);
CMacroFileEntry entry = (CMacroFileEntry)entries.get(0); CMacroFileEntry entry = (CMacroFileEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue()); assertEquals(expected.getValue(), entry.getValue());
assertEquals(expected.getKind(), entry.getKind()); assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags()); assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry); assertEquals(expected, entry);
}
{ assertEquals(new CMacroFileEntry("/macro.file with spaces", 0), entries.get(1));
IPath path = new Path("/macro.file with spaces").setDevice(project.getLocation().getDevice());
CMacroFileEntry expected = new CMacroFileEntry(path, 0);
CMacroFileEntry entry = (CMacroFileEntry)entries.get(1);
assertEquals(expected, entry);
}
} }
/** /**
@ -865,22 +787,15 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{ CLibraryPathEntry expected = new CLibraryPathEntry("/path0", 0);
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice());
CLibraryPathEntry expected = new CLibraryPathEntry(path, 0);
CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(0); CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(0);
assertEquals(expected.getName(), entry.getName()); assertEquals(expected.getName(), entry.getName());
assertEquals(expected.getValue(), entry.getValue()); assertEquals(expected.getValue(), entry.getValue());
assertEquals(expected.getKind(), entry.getKind()); assertEquals(expected.getKind(), entry.getKind());
assertEquals(expected.getFlags(), entry.getFlags()); assertEquals(expected.getFlags(), entry.getFlags());
assertEquals(expected, entry); assertEquals(expected, entry);
}
{ assertEquals(new CLibraryPathEntry("/path with spaces", 0), entries.get(1));
IPath path = new Path("/path with spaces").setDevice(project.getLocation().getDevice());
CLibraryPathEntry expected = new CLibraryPathEntry(path, 0);
CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(1);
assertEquals(expected, entry);
}
} }
/** /**
@ -953,20 +868,12 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
String device = project.getLocation().getDevice(); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
// + " -I/path0 " assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
assertEquals(new CIncludePathEntry(new Path("/path0").setDevice(device), 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
// + " -I /path1 "
assertEquals(new CIncludePathEntry(new Path("/path1").setDevice(device), 0), entries.get(1));
// + " -I\"/path with spaces\""
assertEquals(new CIncludePathEntry(new Path("/path with spaces").setDevice(device), 0), entries.get(2));
// + " -DMACRO1=value"
assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(3)); assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(3));
// + " -DMACRO2=\"value with spaces\""
assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(4)); assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(4));
// + " -L/usr/lib" assertEquals(new CLibraryPathEntry("/usr/lib", 0), entries.get(5));
assertEquals(new CLibraryPathEntry(new Path("/usr/lib").setDevice(device), 0), entries.get(5));
// + " -ldomain"
assertEquals(new CLibraryFileEntry("libdomain.a", 0), entries.get(6)); assertEquals(new CLibraryFileEntry("libdomain.a", 0), entries.get(6));
assertEquals(7, entries.size()); assertEquals(7, entries.size());
} }
@ -1019,13 +926,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check entries // check entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
} }
}
/** /**
* Parsing of absolute path to the file being compiled where provider is global. * Parsing of absolute path to the file being compiled where provider is global.
@ -1053,12 +957,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check entries // check entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(null, file, languageId).get(0));
{ assertEquals(new CIncludePathEntry(file.getParent().getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), parser.getSettingEntries(null, file, languageId).get(1));
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(null, file, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
assertEquals(new CIncludePathEntry(file.getParent().getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
}
} }
/** /**
@ -1090,31 +990,14 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
{
// in single quotes // in single quotes
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file1, languageId).get(0));
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
{
// in double quotes // in double quotes
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file2, languageId).get(0));
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
{
// Unix EOL // Unix EOL
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file3, languageId).get(0));
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
{
// Windows EOL // Windows EOL
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file4, languageId).get(0));
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
} }
/** /**
@ -1150,13 +1033,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check entries // check entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
// Information from build output should take precedence over build dir // Information from build output should take precedence over build dir
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), parser.getSettingEntries(cfgDescription, file, languageId).get(1));
}
} }
/** /**
@ -1186,24 +1065,17 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file0, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file0, languageId);
CIncludePathEntry expected = new CIncludePathEntry(path0, 0); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
assertEquals(expected, entry);
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
CIncludePathEntry expected = new CIncludePathEntry(path0, 0); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
assertEquals(expected, entry);
} }
{ {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
CIncludePathEntry expected = new CIncludePathEntry(path0, 0); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
assertEquals(expected, entry);
} }
} }
@ -1273,14 +1145,12 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
// check that relative paths are relative to CWD which is the location of the project // check that relative paths are relative to CWD which is the location of the project
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(project.getLocation().removeLastSegments(1), 0), entries.get(1)); assertEquals(new CIncludePathEntry(project.getLocation().removeLastSegments(1), 0), entries.get(1));
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
assertEquals(new CIncludePathEntry(folderComposite.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3)); assertEquals(new CIncludePathEntry(folderComposite.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
} }
}
/** /**
* Test various relative paths provided in options without resolving. * Test various relative paths provided in options without resolving.
@ -1313,12 +1183,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(".", 0), entries.get(0)); assertEquals(new CIncludePathEntry(".", 0), entries.get(0));
assertEquals(new CIncludePathEntry("..", 0), entries.get(1)); assertEquals(new CIncludePathEntry("..", 0), entries.get(1));
assertEquals(new CIncludePathEntry("Folder", 0), entries.get(2)); assertEquals(new CIncludePathEntry("Folder", 0), entries.get(2));
} }
}
/** /**
* Ensure that duplicate paths are ignored. * Ensure that duplicate paths are ignored.
@ -1349,11 +1217,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(1, entries.size()); assertEquals(1, entries.size());
} }
}
/** /**
* Test that working directory supplied by ErrorParserManager is considered. * Test that working directory supplied by ErrorParserManager is considered.
@ -1392,14 +1258,12 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
assertEquals(new CIncludePathEntry(buildDir.getLocation().removeLastSegments(3), 0), entries.get(2)); assertEquals(new CIncludePathEntry(buildDir.getLocation().removeLastSegments(3), 0), entries.get(2));
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4)); assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
} }
}
/** /**
* Determine working directory basing on file being compiled. * Determine working directory basing on file being compiled.
@ -1467,12 +1331,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("Folder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2)); assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("Folder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
} }
}
/** /**
* Test case when build command indicates impossible working directory and * Test case when build command indicates impossible working directory and
@ -1509,13 +1371,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
IPath buildPath = new Path(uriBuildDir.getPath()).setDevice(project.getLocation().getDevice()); IPath buildPath = new Path(uriBuildDir.getPath()).setDevice(project.getLocation().getDevice());
assertEquals(new CIncludePathEntry(buildPath, 0), entries.get(0)); assertEquals(new CIncludePathEntry(buildPath, 0), entries.get(0));
assertEquals(new CIncludePathEntry(buildPath.removeLastSegments(1), 0), entries.get(1)); assertEquals(new CIncludePathEntry(buildPath.removeLastSegments(1), 0), entries.get(1));
assertEquals(new CIncludePathEntry(buildPath.append("Folder"), 0), entries.get(2)); assertEquals(new CIncludePathEntry(buildPath.append("Folder"), 0), entries.get(2));
} }
}
/** /**
* Simulate mapping of a sub-folder in the project to remote URI. * Simulate mapping of a sub-folder in the project to remote URI.
@ -1555,14 +1415,12 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
assertEquals(new CIncludePathEntry(folder2.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2)); assertEquals(new CIncludePathEntry(folder2.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3)); assertEquals(new CIncludePathEntry("/BuildDir/MissingFolder", 0), entries.get(3));
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder2"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4)); assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder2"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
} }
}
/** /**
* Test mapping folders heuristics - inside a project. * Test mapping folders heuristics - inside a project.
@ -1601,18 +1459,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(mappedFolder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(mappedFolder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
} assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(2));
{ assertEquals(new CIncludePathEntry("/Missing/Folder", 0), entries.get(3));
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, 0), entries.get(2));
}
{
IPath path = new Path("/Missing/Folder").setDevice(file.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, 0), entries.get(3));
}
} }
/** /**
@ -1654,17 +1504,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
} assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(1));
{ assertEquals(new CIncludePathEntry("/Missing/Folder", 0), entries.get(2));
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, 0), entries.get(1));
}
{
IPath path = new Path("/Missing/Folder").setDevice(file.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, 0), entries.get(2));
}
} }
/** /**
@ -1713,12 +1555,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(folderInReferencedProject.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(folderInReferencedProject.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(1));
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
assertEquals(new CIncludePathEntry(path, 0), entries.get(1));
}
} }
/** /**
@ -1755,12 +1593,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
CIncludePathEntry expected = new CIncludePathEntry(dir2.removeLastSegments(1), 0); CIncludePathEntry expected = new CIncludePathEntry(dir2.removeLastSegments(1), 0);
assertEquals(expected, entries.get(0)); assertEquals(expected, entries.get(0));
} }
}
/** /**
* Test ".." in symbolic links where the symbolic link is present as relative path. * Test ".." in symbolic links where the symbolic link is present as relative path.
@ -1796,12 +1632,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
CIncludePathEntry expected = new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED); CIncludePathEntry expected = new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
assertEquals(expected, entries.get(0)); assertEquals(expected, entries.get(0));
} }
}
/** /**
* Determine working directory from configuration builder settings. * Determine working directory from configuration builder settings.
@ -1841,11 +1675,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
} }
}
/** /**
* Test where working directory from command line disagrees with configuration builder settings. * Test where working directory from command line disagrees with configuration builder settings.
@ -1886,13 +1718,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1)); assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
} }
}
/** /**
* Smoke test when non-C files appear in output, should not choke. * Smoke test when non-C files appear in output, should not choke.
*/ */
@ -1964,12 +1793,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
// cleanup // cleanup
contentType.removeFileSpec("x++", IContentTypeSettings.FILE_EXTENSION_SPEC); contentType.removeFileSpec("x++", IContentTypeSettings.FILE_EXTENSION_SPEC);
@ -1999,12 +1823,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice()); assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
assertEquals(expected, entries.get(0));
}
} }
/** /**
@ -2039,16 +1858,16 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(new Path("/Python1025/Include").setDevice(project.getLocation().getDevice()), 0), entries.get(1)); // "/Python1025/Include" not expected to be there
assertFalse(new java.io.File("/Python1025/Include").exists());
assertEquals(new CIncludePathEntry("/Python1025/Include", 0), entries.get(1));
assertEquals(new CMacroEntry("BOOST_ALL_NO_LIB", "1", 0), entries.get(2)); assertEquals(new CMacroEntry("BOOST_ALL_NO_LIB", "1", 0), entries.get(2));
assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "", 0), entries.get(3)); assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "", 0), entries.get(3));
assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "", 0), entries.get(4)); assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "", 0), entries.get(4));
assertEquals(5, entries.size()); assertEquals(5, entries.size());
} }
}
/** /**
* Test resource file residing on EFS file-system. * Test resource file residing on EFS file-system.
@ -2082,12 +1901,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
String device = project.getLocation().getDevice(); String device = project.getLocation().getDevice();
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0)); assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
assertEquals(new CIncludePathEntry(new Path("/Absolute/Folder").setDevice(device), 0), entries.get(1)); assertEquals(new CIncludePathEntry(new Path("/Absolute/Folder").setDevice(device), 0), entries.get(1));
} }
}
/** /**
* Test mapping entries to EFS. * Test mapping entries to EFS.
@ -2121,11 +1938,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId); List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
{
String device = project.getLocation().getDevice(); String device = project.getLocation().getDevice();
assertEquals(new CIncludePathEntry(new Path("/LocallyMappedTo/Folder").setDevice(device), 0), entries.get(0)); assertEquals(new CIncludePathEntry(new Path("/LocallyMappedTo/Folder").setDevice(device), 0), entries.get(0));
} }
}
/** /**
* Test assigning entries on file level. * Test assigning entries on file level.
@ -2153,14 +1968,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(expected, parser.getSettingEntries(cfgDescription, file, languageId));
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId); assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId));
assertEquals(expected, entriesFile); assertEquals(null, parser.getSettingEntries(cfgDescription, project, languageId));
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId);
assertEquals(null, entriesFolder);
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
assertEquals(null, entriesProject);
} }
/** /**
@ -2189,14 +2000,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId); assertEquals(expected, parser.getSettingEntries(cfgDescription, folder, languageId));
assertEquals(null, entriesFile); assertEquals(null, parser.getSettingEntries(cfgDescription, project, languageId));
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId);
assertEquals(expected, entriesFolder);
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
assertEquals(null, entriesProject);
} }
/** /**
@ -2225,14 +2032,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0)); expected.add(new CIncludePathEntry("/path0", 0));
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId); assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
assertEquals(null, entriesFile); assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId));
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId); assertEquals(expected, parser.getSettingEntries(cfgDescription, project, languageId));
assertEquals(null, entriesFolder);
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
assertEquals(expected, entriesProject);
} }
/** /**
@ -2261,7 +2065,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(expected, parser.getSettingEntries(null, project, languageId)); assertEquals(expected, parser.getSettingEntries(null, project, languageId));
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.managedbuilder.language.settings.providers; package org.eclipse.cdt.managedbuilder.language.settings.providers;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
@ -759,38 +758,61 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
} }
/** /**
* The manipulations here are done to resolve "../" navigation for symbolic links where "link/.." cannot * The manipulations here are done to resolve problems such as "../" navigation for symbolic links where
* be collapsed as it must follow the real file-system path. {@link java.io.File#getCanonicalPath()} deals * "link/.." cannot be collapsed as it must follow the real file-system path. {@link java.io.File#getCanonicalPath()}
* with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect * deals with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect here.
* here. * Another issue being resolved here is fixing drive letters in URI syntax.
*/ */
private static URI resolvePathFromBaseLocation(String name, IPath baseLocation) { private static URI resolvePathFromBaseLocation(String pathStr0, IPath baseLocation) {
String pathName = name; String pathStr = pathStr0;
if (baseLocation != null && !baseLocation.isEmpty()) { if (baseLocation != null && !baseLocation.isEmpty()) {
pathName = pathName.replace(File.separatorChar, '/'); pathStr = pathStr.replace(File.separatorChar, '/');
String device = new Path(pathName).getDevice(); String device = new Path(pathStr).getDevice();
if (device == null || device.equals(baseLocation.getDevice())) { if (device == null || device.equals(baseLocation.getDevice())) {
if (device != null && device.length() > 0) { if (device != null && device.length() > 0) {
pathName = pathName.substring(device.length()); pathStr = pathStr.substring(device.length());
} }
baseLocation = baseLocation.addTrailingSeparator(); baseLocation = baseLocation.addTrailingSeparator();
if (pathName.startsWith("/")) { //$NON-NLS-1$ if (pathStr.startsWith("/")) { //$NON-NLS-1$
pathName = pathName.substring(1); pathStr = pathStr.substring(1);
} }
pathName = baseLocation.toString() + pathName; pathStr = baseLocation.toString() + pathStr;
} }
} }
try { try {
File file = new File(pathName); File file = new File(pathStr);
file = file.getCanonicalFile(); file = file.getCanonicalFile();
return file.toURI(); URI uri = file.toURI();
} catch (IOException e) { if (file.exists()) {
// if error just leave it as is return uri;
} }
return org.eclipse.core.filesystem.URIUtil.toURI(pathName); IPath path0 = new Path(pathStr0);
if (!path0.isAbsolute()) {
return uri;
}
String device = path0.getDevice();
if (device == null || device.isEmpty()) {
// Avoid spurious adding of drive letters on Windows
pathStr = path0.setDevice(null).toString();
} else {
// On Windows "C:/folder/" -> "/C:/folder/"
if (pathStr.charAt(0) != IPath.SEPARATOR) {
pathStr = IPath.SEPARATOR + pathStr;
}
}
return new URI(uri.getScheme(), uri.getAuthority(), pathStr, uri.getQuery(), uri.getFragment());
} catch (Exception e) {
// if error will leave it as is
ManagedBuilderCorePlugin.log(e);
}
return org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
} }
/** /**
@ -934,13 +956,18 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri); String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri);
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr); uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
if (uri != null && uri.isAbsolute()) {
try { try {
File file = new java.io.File(uri); File file = new java.io.File(uri);
String canonicalPathStr = file.getCanonicalPath(); String canonicalPathStr = file.getCanonicalPath();
if (new Path(pathStr).getDevice() == null) {
return new Path(canonicalPathStr).setDevice(null);
}
return new Path(canonicalPathStr); return new Path(canonicalPathStr);
} catch (Exception e) { } catch (Exception e) {
ManagedBuilderCorePlugin.log(e); ManagedBuilderCorePlugin.log(e);
} }
}
return null; return null;
} }

View file

@ -1302,6 +1302,9 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
return selected; return selected;
} }
/**
* @since 8.2
*/
public void setSelection(ITreeOption option) { public void setSelection(ITreeOption option) {
if (treeRoot == getRoot(option)) { // only work in the same tree if (treeRoot == getRoot(option)) { // only work in the same tree
selected = option; selected = option;

View file

@ -15,10 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTTypeId extends IASTNode { public interface IASTTypeId extends IASTNode {
/** public static final IASTTypeId[] EMPTY_TYPEID_ARRAY = {};
* Constant.
*/
public static final IASTTypeId[] EMPTY_TYPEID_ARRAY = new IASTTypeId[0];
/** /**
* <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTTypeId</code> * <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTTypeId</code>
@ -35,7 +32,7 @@ public interface IASTTypeId extends IASTNode {
"IASTTypeId.ABSTRACT_DECLARATOR - IASTDeclarator for IASTTypeId"); //$NON-NLS-1$ "IASTTypeId.ABSTRACT_DECLARATOR - IASTDeclarator for IASTTypeId"); //$NON-NLS-1$
/** /**
* Get the decl specifier. * Returns the decl specifier.
* @return <code>IASTDeclSpecifier</code> * @return <code>IASTDeclSpecifier</code>
*/ */
public IASTDeclSpecifier getDeclSpecifier(); public IASTDeclSpecifier getDeclSpecifier();
@ -54,7 +51,7 @@ public interface IASTTypeId extends IASTNode {
public IASTDeclarator getAbstractDeclarator(); public IASTDeclarator getAbstractDeclarator();
/** /**
* Set the abstract declarator. * Sets the abstract declarator.
* @param abstractDeclarator <code>IASTDeclarator</code> * @param abstractDeclarator <code>IASTDeclarator</code>
*/ */
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator); public void setAbstractDeclarator(IASTDeclarator abstractDeclarator);

View file

@ -16,7 +16,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTTypeIdExpression extends IASTExpression { public interface IASTTypeIdExpression extends IASTExpression {
/** /**
* <code>op_sizeof</code> sizeof (typeId) expression * <code>op_sizeof</code> sizeof (typeId) expression
*/ */

View file

@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTWhileStatement extends IASTStatement { public interface IASTWhileStatement extends IASTStatement {
/** /**
* <code>CONDITIONEXPRESSION</code> represents the relationship between an <code>IASTWhileStatement</code> and * <code>CONDITIONEXPRESSION</code> represents the relationship between an <code>IASTWhileStatement</code> and
* it's nested <code>IASTExpression</code>. * it's nested <code>IASTExpression</code>.

View file

@ -19,7 +19,6 @@ package org.eclipse.cdt.core.dom.ast;
* @since 5.3 * @since 5.3
*/ */
public interface ICPPASTCompletionContext extends IASTCompletionContext { public interface ICPPASTCompletionContext extends IASTCompletionContext {
/** /**
* Returns bindings that start with the given name or prefix, only considering those that are valid for * Returns bindings that start with the given name or prefix, only considering those that are valid for
* this context, including those in the requested set of namespaces. * this context, including those in the requested set of namespaces.

View file

@ -21,15 +21,16 @@ public interface ICompositeType extends IBinding, IType {
public static final int k_union = IASTCompositeTypeSpecifier.k_union; public static final int k_union = IASTCompositeTypeSpecifier.k_union;
/** /**
* Returns the type of the composite, {@link #k_struct}, {@link #k_union}, or * Returns the type of the composite, {@link #k_struct}, {@link #k_union},
* {@link org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#k_class}. * or {@link org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#k_class}.
*/ */
public int getKey(); public int getKey();
/** /**
* Returns whether the type is anonymous or not. A type for which objects or * Returns whether the type is anonymous or not. A type for which objects or
* pointers are declared is not considered an anonymous type. * pointers are declared is not considered an anonymous type.
* <pre> struct Outer { * <pre>
* struct Outer {
* struct {int a;}; // anonymous * struct {int a;}; // anonymous
* struct {int b;} c; // not anonymous * struct {int b;} c; // not anonymous
* } * }

View file

@ -17,8 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
/** /**
* Place-holder in the AST for template arguments that are not yet * Place-holder in the AST for template arguments that are not yet understood.
* understood.
* *
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.

View file

@ -10,11 +10,10 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
/** /**
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPConstructor extends ICPPMethod { public interface ICPPConstructor extends ICPPMethod {
public static final ICPPConstructor [] EMPTY_CONSTRUCTOR_ARRAY = new ICPPConstructor[0]; public static final ICPPConstructor[] EMPTY_CONSTRUCTOR_ARRAY = {};
} }

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPEnumeration extends IEnumeration, ICPPBinding { public interface ICPPEnumeration extends IEnumeration, ICPPBinding {
/** /**
* Returns whether this enumeration is scoped. * Returns whether this enumeration is scoped.
* An enumeration can only be scoped in C++. * An enumeration can only be scoped in C++.

View file

@ -17,6 +17,5 @@ import org.eclipse.cdt.core.dom.ast.IField;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPField extends IField, ICPPMember, ICPPVariable { public interface ICPPField extends IField, ICPPMember, ICPPVariable {
public static final ICPPField [] EMPTY_CPPFIELD_ARRAY = new ICPPField[0]; public static final ICPPField[] EMPTY_CPPFIELD_ARRAY = {};
} }

View file

@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPFunctionScope extends ICPPScope { public interface ICPPFunctionScope extends ICPPScope {
/** /**
* Get the scope representing the function body. returns null if there is no * Get the scope representing the function body. returns null if there is no
* function definition * function definition

View file

@ -17,5 +17,4 @@ package org.eclipse.cdt.core.dom.ast.cpp;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
*/ */
public interface ICPPFunctionTemplate extends ICPPFunction, ICPPTemplateDefinition { public interface ICPPFunctionTemplate extends ICPPFunction, ICPPTemplateDefinition {
} }

View file

@ -91,7 +91,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return CPPSemantics.resolveAmbiguities(name, specs); return CPPSemantics.resolveAmbiguities(name, specs);
} }
@Deprecated @Override @Deprecated
@Override
final public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, final public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup,
IIndexFileSet fileSet) { IIndexFileSet fileSet) {
return getBindings(new ScopeLookupData(name, resolve, prefixLookup)); return getBindings(new ScopeLookupData(name, resolve, prefixLookup));

View file

@ -15,8 +15,8 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression;
public class CPPASTAmbiguousCastVsFunctionCallExpression extends public class CPPASTAmbiguousCastVsFunctionCallExpression
ASTAmbiguousCastVsFunctionCallExpression implements ICPPASTExpression { extends ASTAmbiguousCastVsFunctionCallExpression implements ICPPASTExpression {
public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall) { public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall) {
super(castExpr, funcCall); super(castExpr, funcCall);

View file

@ -18,9 +18,8 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
public class CPPASTAmbiguousExpression extends ASTAmbiguousNode implements public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
IASTAmbiguousExpression, ICPPASTExpression { implements IASTAmbiguousExpression, ICPPASTExpression {
private IASTExpression[] exp = new IASTExpression[2]; private IASTExpression[] exp = new IASTExpression[2];
private int expPos= -1; private int expPos= -1;
@ -29,7 +28,6 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode implements
addExpression(e); addExpression(e);
} }
@Override @Override
public IASTExpression copy() { public IASTExpression copy() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View file

@ -34,9 +34,8 @@ import org.eclipse.core.runtime.Assert;
* <br> * <br>
* template<typename... T> void function(T ...); // is T a parameter pack? * template<typename... T> void function(T ...); // is T a parameter pack?
*/ */
public class CPPASTAmbiguousParameterDeclaration extends ASTAmbiguousNode implements public class CPPASTAmbiguousParameterDeclaration extends ASTAmbiguousNode
IASTAmbiguousParameterDeclaration, ICPPASTParameterDeclaration { implements IASTAmbiguousParameterDeclaration, ICPPASTParameterDeclaration {
private ICPPASTParameterDeclaration fParameterDecl; private ICPPASTParameterDeclaration fParameterDecl;
public CPPASTAmbiguousParameterDeclaration(ICPPASTParameterDeclaration decl) { public CPPASTAmbiguousParameterDeclaration(ICPPASTParameterDeclaration decl) {
@ -48,7 +47,6 @@ public class CPPASTAmbiguousParameterDeclaration extends ASTAmbiguousNode implem
assert false; assert false;
} }
@Override @Override
protected final IASTNode doResolveAmbiguity(ASTVisitor resolver) { protected final IASTNode doResolveAmbiguity(ASTVisitor resolver) {
final IASTAmbiguityParent owner= (IASTAmbiguityParent) getParent(); final IASTAmbiguityParent owner= (IASTAmbiguityParent) getParent();

View file

@ -32,9 +32,10 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAm
private IASTDeclaration fDeclaration; private IASTDeclaration fDeclaration;
public CPPASTAmbiguousStatement(IASTStatement... statements) { public CPPASTAmbiguousStatement(IASTStatement... statements) {
for (IASTStatement s : statements) for (IASTStatement s : statements) {
addStatement(s); addStatement(s);
} }
}
@Override @Override
protected void beforeResolution() { protected void beforeResolution() {

View file

@ -33,11 +33,11 @@ import org.eclipse.core.runtime.Assert;
* Ambiguity node for deciding between type-id and id-expression in a template argument. * Ambiguity node for deciding between type-id and id-expression in a template argument.
*/ */
public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements ICPPASTAmbiguousTemplateArgument { public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements ICPPASTAmbiguousTemplateArgument {
private List<IASTNode> fNodes; private List<IASTNode> fNodes;
/** /**
* @param nodes nodes of type {@link IASTTypeId}, {@link IASTIdExpression} or {@link ICPPASTPackExpansionExpression}. * @param nodes nodes of type {@link IASTTypeId}, {@link IASTIdExpression}
* or {@link ICPPASTPackExpansionExpression}.
*/ */
public CPPASTAmbiguousTemplateArgument(IASTNode... nodes) { public CPPASTAmbiguousTemplateArgument(IASTNode... nodes) {
fNodes= new ArrayList<IASTNode>(2); fNodes= new ArrayList<IASTNode>(2);
@ -57,7 +57,6 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
} }
} }
@Override @Override
protected void beforeAlternative(IASTNode node) { protected void beforeAlternative(IASTNode node) {
// The name may be shared between the alternatives make sure it's parent is set correctly // The name may be shared between the alternatives make sure it's parent is set correctly
@ -77,13 +76,11 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
} }
} }
@Override @Override
protected void afterResolution(ASTVisitor resolver, IASTNode best) { protected void afterResolution(ASTVisitor resolver, IASTNode best) {
beforeAlternative(best); beforeAlternative(best);
} }
@Override @Override
public IASTNode copy() { public IASTNode copy() {
return copy(CopyStyle.withoutLocations); return copy(CopyStyle.withoutLocations);
@ -91,7 +88,6 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
@Override @Override
public IASTNode copy(CopyStyle style) { public IASTNode copy(CopyStyle style) {
int sizeOfNodes = fNodes.size(); int sizeOfNodes = fNodes.size();
IASTNode[] copyNodes = new IASTNode[sizeOfNodes]; IASTNode[] copyNodes = new IASTNode[sizeOfNodes];
int arrayIndex = 0; int arrayIndex = 0;

View file

@ -16,7 +16,17 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ARRAY;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.MPTR;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.PTR;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.calculateInheritanceDepth;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.isConversionOperator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View file

@ -51,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue; import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
@ -1706,6 +1707,10 @@ public class CPPTemplates {
IType type= expr.getExpressionType(); IType type= expr.getExpressionType();
IValue value= Value.create((IASTExpression) arg, Value.MAX_RECURSION_DEPTH); IValue value= Value.create((IASTExpression) arg, Value.MAX_RECURSION_DEPTH);
result[i]= new CPPTemplateArgument(value, type); result[i]= new CPPTemplateArgument(value, type);
} else if (arg instanceof ICPPASTAmbiguousTemplateArgument) {
throw new IllegalArgumentException(id.getRawSignature()
+ " contains an ambiguous template argument at position " + i + " in " //$NON-NLS-1$ //$NON-NLS-2$
+ id.getContainingFilename());
} else { } else {
throw new IllegalArgumentException("Unexpected type: " + arg.getClass().getName()); //$NON-NLS-1$ throw new IllegalArgumentException("Unexpected type: " + arg.getClass().getName()); //$NON-NLS-1$
} }
@ -2250,10 +2255,11 @@ public class CPPTemplates {
} }
if (!matchTemplateTemplateParameters(((ICPPTemplateTemplateParameter) pp).getTemplateParameters(), if (!matchTemplateTemplateParameters(((ICPPTemplateTemplateParameter) pp).getTemplateParameters(),
((ICPPTemplateTemplateParameter) ap).getTemplateParameters()) ) ((ICPPTemplateTemplateParameter) ap).getTemplateParameters())) {
return false; return false;
} }
} }
}
if (!pp.isParameterPack()) if (!pp.isParameterPack())
pi++; pi++;
ai++; ai++;

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.eclipse.cdt</groupId> <groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId> <artifactId>cdt-parent</artifactId>
<version>8.1.0-SNAPSHOT</version> <version>8.2.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>