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-10-29 09:15:59 -04:00
commit 302019d89d
85 changed files with 2026 additions and 1016 deletions

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<requires> <requires>
<import plugin="org.eclipse.cdt.managedbuilder.core" version="5.0.100" match="greaterOrEqual"/> <import plugin="org.eclipse.cdt.managedbuilder.core" version="5.0.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.cdt.core" version="5.1.0" match="greaterOrEqual"/> <import plugin="org.eclipse.cdt.core" version="5.1.0" match="greaterOrEqual"/>

View file

@ -4,5 +4,5 @@ provides.99.namespace=org.eclipse.equinox.p2.iu
provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group
provides.99.version=$version$ provides.99.version=$version$
instructions.configure=\ instructions.configure=\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:0,name:CDT,enabled:false); \ org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:0,name:CDT,enabled:false); \
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:1,name:CDT,enabled:false); org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:1,name:CDT,enabled:false);

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.autotools.core.source" id="org.eclipse.cdt.autotools.core.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.gnu.ui" id="org.eclipse.cdt.managedbuilder.gnu.ui"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.gnu.ui.source" id="org.eclipse.cdt.managedbuilder.gnu.ui.source"
download-size="0" download-size="0"

View file

@ -17,6 +17,7 @@ import java.util.List;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.AbstractExecutableExtensionBase; import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CMacroEntry; import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
@ -649,6 +650,38 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
assertEquals(3, includes.size()); assertEquals(3, includes.size());
} }
/**
* Test ability to get entries by kind.
*/
public void testEntriesByKind_CompositeKind() throws Exception {
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
// contribute the entries
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
entries.add(new CIncludePathEntry("path0", 0));
entries.add(new CMacroEntry("MACRO0", "value0",0));
entries.add(new CIncludePathEntry("path1", 0));
entries.add(new CMacroEntry("MACRO1", "value1",0));
entries.add(new CIncludePathEntry("path2", 0));
entries.add(new CIncludeFileEntry("include-path-file", 0));
ILanguageSettingsProvider provider0 = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, entries);
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
providers.add(provider0);
cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind
List<ICLanguageSettingEntry> result = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO);
assertEquals(new CIncludePathEntry("path0", 0), result.get(0));
assertEquals(new CMacroEntry("MACRO0", "value0",0), result.get(1));
assertEquals(new CIncludePathEntry("path1", 0), result.get(2));
assertEquals(new CMacroEntry("MACRO1", "value1",0), result.get(3));
assertEquals(new CIncludePathEntry("path2", 0), result.get(4));
assertEquals(5, result.size());
}
/** /**
* Test ability to serialize providers for a configuration. * Test ability to serialize providers for a configuration.
*/ */

View file

@ -97,7 +97,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return name; return name;
} }
} }
return null; return null;
} }
@ -122,7 +122,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len); IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name); assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature()); assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding(); IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding); assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass())); assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@ -136,11 +136,11 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
protected <T extends IBinding> T getBindingFromASTName(String section, int len) { protected <T extends IBinding> T getBindingFromASTName(String section, int len) {
if (len <= 0) if (len <= 0)
len += section.length(); len += section.length();
IASTName name= findName(section, len); IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name); assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature()); assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding(); IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding); assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass())); assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@ -157,7 +157,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len); IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name); assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature()); assertEquals(section.substring(0, len), name.getRawSignature());
IBinding binding = name.resolveBinding(); IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding); assertNotNull("No binding for " + name.getRawSignature(), binding);
assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass())); assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@ -267,13 +267,13 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return null; return null;
return nameList.get(idx); return nameList.get(idx);
} }
public int size() { public int size() {
return nameList.size(); return nameList.size();
} }
} }
interface ITestStrategy { protected interface ITestStrategy {
IIndex getIndex(); IIndex getIndex();
void setUp() throws Exception; void setUp() throws Exception;
void tearDown() throws Exception; void tearDown() throws Exception;
@ -300,7 +300,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() { public ICProject getCProject() {
return cproject; return cproject;
} }
@Override @Override
public StringBuilder[] getTestData() { public StringBuilder[] getTestData() {
return testData; return testData;
@ -365,7 +365,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() { public IIndex getIndex() {
return index; return index;
} }
@Override @Override
public boolean isCompositeIndex() { public boolean isCompositeIndex() {
return false; return false;
@ -426,7 +426,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("references.c" + (cpp ? "pp" : "")), testData[1].toString()); IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("references.c" + (cpp ? "pp" : "")), testData[1].toString());
waitForIndexer(cproject); waitForIndexer(cproject);
if (DEBUG) { if (DEBUG) {
System.out.println("Project PDOM: " + getName()); System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter()); ((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@ -452,7 +452,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() { public IIndex getIndex() {
return index; return index;
} }
@Override @Override
public boolean isCompositeIndex() { public boolean isCompositeIndex() {
return false; return false;
@ -467,7 +467,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
* to put the contents of the section to. To request the AST of a file, put an asterisk after * to put the contents of the section to. To request the AST of a file, put an asterisk after
* the file name. * the file name.
*/ */
class SinglePDOMTestNamedFilesStrategy implements ITestStrategy { protected class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
private IIndex index; private IIndex index;
private ICProject cproject; private ICProject cproject;
private StringBuilder[] testData; private StringBuilder[] testData;
@ -536,7 +536,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
} }
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER); CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
waitForIndexer(cproject); waitForIndexer(cproject);
if (DEBUG) { if (DEBUG) {
System.out.println("Project PDOM: " + getName()); System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter()); ((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@ -564,7 +564,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() { public IIndex getIndex() {
return index; return index;
} }
@Override @Override
public boolean isCompositeIndex() { public boolean isCompositeIndex() {
return false; return false;
@ -586,7 +586,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() { public ICProject getCProject() {
return cproject; return cproject;
} }
@Override @Override
public void tearDown() throws Exception { public void tearDown() throws Exception {
if (index != null) { if (index != null) {
@ -620,7 +620,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(cproject); CCorePlugin.getIndexManager().reindex(cproject);
waitForIndexer(cproject); waitForIndexer(cproject);
if (DEBUG) { if (DEBUG) {
System.out.println("Online: "+getName()); System.out.println("Online: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter()); ((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@ -637,17 +637,17 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
CProjectHelper.createCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER); CProjectHelper.createCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
String content = testData[0].toString(); String content = testData[0].toString();
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content); IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER); IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(referenced); CCorePlugin.getIndexManager().reindex(referenced);
waitForIndexer(referenced); waitForIndexer(referenced);
if (DEBUG) { if (DEBUG) {
System.out.println("Referenced: "+getName()); System.out.println("Referenced: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter()); ((PDOM) CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter());
} }
return referenced; return referenced;
} }
@ -679,7 +679,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public StringBuilder[] getTestData() { public StringBuilder[] getTestData() {
return testData; return testData;
} }
@Override @Override
public boolean isCompositeIndex() { public boolean isCompositeIndex() {
return true; return true;

View file

@ -240,7 +240,7 @@ public class BaseTestCase extends TestCase {
* in the log should fail the test. If the logged number of non-OK status objects * in the log should fail the test. If the logged number of non-OK status objects
* differs from the last value passed, the test is failed. If this method is not called * differs from the last value passed, the test is failed. If this method is not called
* at all, the expected number defaults to zero. * at all, the expected number defaults to zero.
* @param value * @param count the expected number of logged error and warning messages
*/ */
public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) { public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) {
fExpectedLoggedNonOK= count; fExpectedLoggedNonOK= count;
@ -306,7 +306,7 @@ public class BaseTestCase extends TestCase {
assertTrue(indexManager.isProjectRegistered(project)); assertTrue(indexManager.isProjectRegistered(project));
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm())); assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
} }
public static void waitUntilFileIsIndexed(IIndex index, IFile file) throws Exception { public static void waitUntilFileIsIndexed(IIndex index, IFile file) throws Exception {
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000); TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000);
} }

View file

@ -0,0 +1,113 @@
/*******************************************************************************
* Copyright (c) 2012 Google, Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.testplugin.util;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.internal.core.CCoreInternals;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.pdom.tests.PDOMPrettyPrinter;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
/**
* Base class for tests that use AST. The files in the test project are created from the comments
* preceding the test case. The test project will contain a single source file called source.cpp or
* source.c, depending on whether the project is for C++ or C, and zero or more header files called
* header1.h, header2.h, etc. The AST is created for the source file only and can be obtained
* by calling getAst().
*/
public class OneSourceMultipleHeadersTestCase extends BaseTestCase {
private static final boolean DEBUG = false;
private final TestSourceReader testSourceReader;
private final boolean cpp;
private IIndex index;
private ICProject cproject;
private StringBuilder[] testData;
private IASTTranslationUnit ast;
public OneSourceMultipleHeadersTestCase(TestSourceReader testSourceReader, boolean cpp) {
this(null, testSourceReader, cpp);
}
public OneSourceMultipleHeadersTestCase(String name, TestSourceReader testSourceReader,
boolean cpp) {
super(name);
this.testSourceReader = testSourceReader;
this.cpp = cpp;
}
protected ICProject getCProject() {
return cproject;
}
protected IIndex getIndex() {
return index;
}
protected StringBuilder[] getTestData() {
return testData;
}
protected IASTTranslationUnit getAst() {
return ast;
}
public String getAstSource() {
return testData[testData.length - 1].toString();
}
@Override
protected void setUp() throws Exception {
cproject = cpp ?
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
testData = testSourceReader.getContentsForTest(getName());
if (testData.length > 0) {
for (int i = 0; i < testData.length - 1; i++) {
String filename = String.format("header%d.h", i + 1);
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path(filename), testData[i].toString());
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
}
}
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("source.c" + (cpp ? "pp" : "")), getAstSource());
waitForIndexer(cproject);
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
}
index= CCorePlugin.getIndexManager().getIndex(cproject);
index.acquireReadLock();
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
}
@Override
protected void tearDown() throws Exception {
if (index != null) {
index.releaseReadLock();
}
if (cproject != null) {
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
}
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,7 +8,8 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
*******************************************************************************/ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.testplugin.util; package org.eclipse.cdt.core.testplugin.util;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -57,23 +58,61 @@ import org.osgi.framework.Bundle;
* Utilities for reading test source code from plug-in .java sources * Utilities for reading test source code from plug-in .java sources
*/ */
public class TestSourceReader { public class TestSourceReader {
private final Bundle bundle;
private final String srcRoot;
private final Class clazz;
private final int numSections;
/**
* @param bundle the bundle containing the source, if {@code null} can try to load using
* classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
*/
public TestSourceReader(Bundle bundle, String srcRoot, Class clazz) {
this(bundle, srcRoot, clazz, 0);
}
/**
* @param bundle the bundle containing the source, if {@code null} can try to load using
* classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
* @param numSections the number of comment sections preceding the named test to return.
* Pass zero to get all available sections.
*/
public TestSourceReader(Bundle bundle, String srcRoot, Class clazz, int numSections) {
this.bundle = bundle;
this.srcRoot = srcRoot;
this.clazz = clazz;
this.numSections = numSections;
}
public StringBuilder[] getContentsForTest(final String testName) throws IOException {
return getContentsForTest(bundle, srcRoot, clazz, testName, numSections);
}
public String readTaggedComment(String tag) throws IOException {
return readTaggedComment(bundle, tag, clazz, tag);
}
/** /**
* Returns an array of StringBuilder objects for each comment section found preceding the named * Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* *
* @param bundle the bundle containing the source, if null can try to load using classpath * @param bundle the bundle containing the source, if {@code null} can try to load using
* (source folder has to be in the classpath for this to work) * classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages * @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test * @param clazz the name of the class containing the test
* @param testName the name of the test * @param testName the name of the test
* @param sections the number of comment sections preceding the named test to return. Pass zero * @param numSections the number of comment sections preceding the named test to return.
* to get all available sections. * Pass zero to get all available sections.
* @return an array of StringBuilder objects for each comment section found preceding the named * @return an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* @throws IOException * @throws IOException
*/ */
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
final String testName, int sections) throws IOException { final String testName, int numSections) throws IOException {
// Walk up the class inheritance chain until we find the test method. // Walk up the class inheritance chain until we find the test method.
try { try {
while (clazz.getMethod(testName).getDeclaringClass() != clazz) { while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
@ -91,7 +130,7 @@ public class TestSourceReader {
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$")); fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java"; String classFile = fqn + ".java";
IPath filePath= new Path(srcRoot + '/' + classFile); IPath filePath= new Path(srcRoot + '/' + classFile);
InputStream in; InputStream in;
Class superclass = clazz.getSuperclass(); Class superclass = clazz.getSuperclass();
try { try {
@ -107,7 +146,7 @@ public class TestSourceReader {
clazz = superclass; clazz = superclass;
continue; continue;
} }
BufferedReader br = new BufferedReader(new InputStreamReader(in)); BufferedReader br = new BufferedReader(new InputStreamReader(in));
try { try {
// Read the java file collecting comments until we encounter the test method. // Read the java file collecting comments until we encounter the test method.
@ -120,7 +159,7 @@ public class TestSourceReader {
} else { } else {
if (!line.startsWith("@") && content.length() > 0) { if (!line.startsWith("@") && content.length() > 0) {
contents.add(content); contents.add(content);
if (sections > 0 && contents.size() == sections + 1) if (numSections > 0 && contents.size() == numSections + 1)
contents.remove(0); contents.remove(0);
content = new StringBuilder(); content = new StringBuilder();
} }
@ -145,14 +184,14 @@ public class TestSourceReader {
clazz = superclass; clazz = superclass;
} }
} }
/** /**
* Searches for the offset of the first occurrence of a string in a workspace file. * Searches for the offset of the first occurrence of a string in a workspace file.
* @param lookfor string to be searched for * @param lookfor string to be searched for
* @param fullPath full path of the workspace file * @param fullPath full path of the workspace file
* @return the offset or -1 * @return the offset or -1
* @throws Exception * @throws Exception
* @throws UnsupportedEncodingException * @throws UnsupportedEncodingException
* @since 4.0 * @since 4.0
*/ */
public static int indexOfInFile(String lookfor, Path fullPath) throws Exception { public static int indexOfInFile(String lookfor, Path fullPath) throws Exception {
@ -183,7 +222,7 @@ public class TestSourceReader {
reader.close(); reader.close();
} }
} }
public static int getLineNumber(int offset, Path fullPath) throws Exception { public static int getLineNumber(int offset, Path fullPath) throws Exception {
IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath); IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath);
Reader reader= new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset())); Reader reader= new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset()));
@ -203,12 +242,12 @@ public class TestSourceReader {
/** /**
* Reads a section in comments form the source of the given class. The section * Reads a section in comments form the source of the given class. The section
* is started with '// {tag}' and ends with the first line not started by '//' * is started with '// {tag}' and ends with the first line not started by '//'
* @since 4.0 * @since 4.0
*/ */
public static String readTaggedComment(Bundle bundle, String srcRoot, Class clazz, final String tag) throws IOException { public static String readTaggedComment(Bundle bundle, String srcRoot, Class clazz, final String tag) throws IOException {
IPath filePath= new Path(srcRoot + '/' + clazz.getName().replace('.', '/') + ".java"); IPath filePath= new Path(srcRoot + '/' + clazz.getName().replace('.', '/') + ".java");
InputStream in= FileLocator.openStream(bundle, filePath, false); InputStream in= FileLocator.openStream(bundle, filePath, false);
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in)); LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
boolean found= false; boolean found= false;
@ -244,15 +283,15 @@ public class TestSourceReader {
} }
/** /**
* Creates a file with content at the given path inside the given container. * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced. * If the file exists its content is replaced.
* @param container a container to create the file in * @param container a container to create the file in
* @param filePath the path relative to the container to create the file at * @param filePath the path relative to the container to create the file at
* @param contents the content for the file * @param contents the content for the file
* @return a file object. * @return a file object.
* @throws CoreException * @throws CoreException
* @since 4.0 * @since 4.0
*/ */
public static IFile createFile(final IContainer container, final IPath filePath, public static IFile createFile(final IContainer container, final IPath filePath,
final CharSequence contents) throws CoreException { final CharSequence contents) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace(); final IWorkspace ws = ResourcesPlugin.getWorkspace();
@ -295,7 +334,7 @@ public class TestSourceReader {
} }
/** /**
* Creates a file with content at the given path inside the given container. * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced. * If the file exists its content is replaced.
* @param container a container to create the file in * @param container a container to create the file in
* @param filePath the path relative to the container to create the file at * @param filePath the path relative to the container to create the file at
@ -309,7 +348,7 @@ public class TestSourceReader {
/** /**
* Waits until the given file is indexed. Fails if this does not happen within the * Waits until the given file is indexed. Fails if this does not happen within the
* given time. * given time.
* @param file * @param file
* @param maxmillis * @param maxmillis
* @throws Exception * @throws Exception
@ -338,7 +377,7 @@ public class TestSourceReader {
} finally { } finally {
index.releaseReadLock(); index.releaseReadLock();
} }
Thread.sleep(50); Thread.sleep(50);
timeLeft= (int) (endTime - System.currentTimeMillis()); timeLeft= (int) (endTime - System.currentTimeMillis());
} }

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -39,6 +40,29 @@ import org.eclipse.core.runtime.IPath;
* @since 5.4 * @since 5.4
*/ */
public class LanguageSettingsManager { public class LanguageSettingsManager {
/**
* Returns the list of setting entries of a certain kind (such as include paths)
* for the given configuration description, resource and language. This is a
* combined list for all providers taking into account settings of parent folder
* if settings for the given resource are not defined. For include paths both
* local (#include "...") and system (#include <...>) entries are returned.
*
* @param cfgDescription - configuration description.
* @param rc - resource such as file or folder.
* @param languageId - language id.
* @param kind - kind of language settings entries, such as
* {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag
* and it is possible to specify composite kind.
* Use {@link ICSettingEntry#ALL} to get all kinds.
*
* @return the list of setting entries.
*
* @since 5.5
*/
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) {
return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, languageId, kind);
}
/** /**
* Returns the list of setting entries of the given provider * Returns the list of setting entries of the given provider
* for the given configuration description, resource and language. * for the given configuration description, resource and language.

View file

@ -13,10 +13,13 @@
package org.eclipse.cdt.core.model; package org.eclipse.cdt.core.model;
import java.net.URI; import java.net.URI;
import java.util.List;
import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStore;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting; import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
@ -1253,27 +1256,41 @@ public class CoreModel {
if(!mngr.isNewStyleCfg(indexCfg)){ if(!mngr.isNewStyleCfg(indexCfg)){
return oldIsScannerInformationEmpty(resource); return oldIsScannerInformationEmpty(resource);
} }
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
if(lSetting != null && lSetting instanceof CLanguageSettingCache){ if (indexCfg instanceof ILanguageSettingsProvidersKeeper) {
if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo()) List<String> languageIds = LanguageSettingsManager.getLanguages(resource, indexCfg);
lSetting = null; for (String langId : languageIds) {
} List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(indexCfg, resource, langId,
if(lSetting != null){ ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO | ICSettingEntry.INCLUDE_FILE | ICSettingEntry.MACRO_FILE);
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH); if (!(entries == null || entries.isEmpty())) {
if(entries.length != 0) return false;
return false; }
}
return true;
entries = lSetting.getSettingEntries(ICSettingEntry.MACRO); } else {
if(entries.length != 0) ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
return false; if(lSetting != null && lSetting instanceof CLanguageSettingCache){
if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo())
lSetting = null;
}
if(lSetting != null){
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
if(entries.length != 0)
return false;
entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_FILE); entries = lSetting.getSettingEntries(ICSettingEntry.MACRO);
if(entries.length != 0) if(entries.length != 0)
return false; return false;
entries = lSetting.getSettingEntries(ICSettingEntry.MACRO_FILE); entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_FILE);
if(entries.length != 0) if(entries.length != 0)
return false; return false;
entries = lSetting.getSettingEntries(ICSettingEntry.MACRO_FILE);
if(entries.length != 0)
return false;
}
} }
} }
} }

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.core.settings.model;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor; import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider; import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
@ -369,12 +370,16 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
boolean isPreferenceConfiguration(); boolean isPreferenceConfiguration();
/** /**
* Convenience method to return a language setting for the file * @deprecated Deprecated as of CDT 8.1. This method returns settings supplied by MBS only.
* with the specified project-relative path * For most cases, more generic Language Settings Providers mechanism should be used instead, see
* {@link LanguageSettingsManager#getSettingEntriesByKind(ICConfigurationDescription, org.eclipse.core.resources.IResource, String, int)}.
* *
* Convenience method to return a language setting for the file with the specified project-relative path.
*
* @param path - file project relative path * @param path - file project relative path
* @return ICLanguageSetting or null if not found * @return ICLanguageSetting or null if not found
*/ */
@Deprecated
ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus); ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus);
/** /**

View file

@ -1555,7 +1555,7 @@ public class LanguageSettingsProvidersSerializer {
for (ICLanguageSettingEntry entry : providerEntries) { for (ICLanguageSettingEntry entry : providerEntries) {
if (entry != null) { if (entry != null) {
String entryName = entry.getName(); String entryName = entry.getName();
boolean isRightKind = checkBit(entry.getKind(), kind); boolean isRightKind = checkBit(kind, entry.getKind());
// Only first entry is considered // Only first entry is considered
// Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line // Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line
if (isRightKind && !alreadyAdded.contains(entryName)) { if (isRightKind && !alreadyAdded.contains(entryName)) {

View file

@ -183,7 +183,8 @@ public class ASTTypeUtil {
if (val != null) { if (val != null) {
buf.append(val.getSignature()); buf.append(val.getSignature());
} else { } else {
appendType(arg.getTypeValue(), normalize, buf); IType type = normalize ? arg.getTypeValue() : arg.getOriginalTypeValue();
appendType(type, normalize, buf);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,7 +7,8 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -15,53 +16,61 @@ import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
/** /**
* Models the value of a template parameter or for the argument of a template-id. * Models the value of a template parameter or for the argument of a template-id.
* Such a value can either be a type-value, or an integral value. * Such a value can either be a type-value, or an integral value.
* *
* @since 5.1 * @since 5.1
* @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 ICPPTemplateArgument { public interface ICPPTemplateArgument {
ICPPTemplateArgument[] EMPTY_ARGUMENTS = {}; ICPPTemplateArgument[] EMPTY_ARGUMENTS = {};
/** /**
* Returns whether this is an integral value, suitable for a template non-type parameter. * Returns whether this is an integral value, suitable for a template non-type parameter.
*/ */
boolean isNonTypeValue(); boolean isNonTypeValue();
/** /**
* Returns whether this is a type value, suitable for either a template type or a * Returns whether this is a type value, suitable for either a template type or a
* template template parameter. * template template parameter.
*/ */
boolean isTypeValue(); boolean isTypeValue();
/** /**
* If this is a type value (suitable for a template type and template template parameters), * If this is a type value (suitable for a template type and template template parameters),
* the type used as a value is returned. * the type used as a value is returned.
* For non-type values, <code>null</code> is returned. * For non-type values, <code>null</code> is returned.
* The returned type has all typedefs resolved.
*/ */
IType getTypeValue(); IType getTypeValue();
/** /**
* If this is a non-type value (suitable for a template non-type parameters), * Similar to {@link #getTypeValue()} but returns the original type value before typedef
* the evaluation object is returned. * resolution.
* For type values, <code>null</code> is returned. * @since 5.5
*/
IType getOriginalTypeValue();
/**
* If this is a non-type value (suitable for a template non-type parameters),
* the evaluation object is returned.
* For type values, <code>null</code> is returned.
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
ICPPEvaluation getNonTypeEvaluation(); ICPPEvaluation getNonTypeEvaluation();
/** /**
* If this is a non-type value (suitable for a template non-type parameters), * If this is a non-type value (suitable for a template non-type parameters),
* the value is returned. * the value is returned.
* For type values, <code>null</code> is returned. * For type values, <code>null</code> is returned.
*/ */
IValue getNonTypeValue(); IValue getNonTypeValue();
/** /**
* If this is a non-type value (suitable for a template non-type parameter), * If this is a non-type value (suitable for a template non-type parameter),
* the type of the value is returned. * the type of the value is returned.
* For type values, <code>null</code> is returned. * For type values, <code>null</code> is returned.
*/ */
IType getTypeOfNonTypeValue(); IType getTypeOfNonTypeValue();
@ -69,7 +78,7 @@ public interface ICPPTemplateArgument {
* Checks whether two arguments denote the same value. * Checks whether two arguments denote the same value.
*/ */
boolean isSameValue(ICPPTemplateArgument arg); boolean isSameValue(ICPPTemplateArgument arg);
/** /**
* Returns whether this template argument is a pack expansion or not. * Returns whether this template argument is a pack expansion or not.
* @since 5.2 * @since 5.2

View file

@ -20,18 +20,18 @@ import org.eclipse.core.runtime.CoreException;
* Buffer for marshalling and unmarshalling types. * Buffer for marshalling and unmarshalling types.
*/ */
public interface ITypeMarshalBuffer { public interface ITypeMarshalBuffer {
final static byte BASIC_TYPE= 1; final static byte BASIC_TYPE= 1;
final static byte POINTER_TYPE= 2; final static byte POINTER_TYPE= 2;
final static byte ARRAY_TYPE= 3; final static byte ARRAY_TYPE= 3;
final static byte CVQUALIFIER_TYPE= 4; final static byte CVQUALIFIER_TYPE= 4;
final static byte FUNCTION_TYPE= 5; final static byte FUNCTION_TYPE= 5;
final static byte REFERENCE_TYPE= 6; final static byte REFERENCE_TYPE= 6;
final static byte POINTER_TO_MEMBER_TYPE= 7; final static byte POINTER_TO_MEMBER_TYPE= 7;
final static byte PACK_EXPANSION_TYPE= 8; final static byte PACK_EXPANSION_TYPE= 8;
final static byte PROBLEM_TYPE= 9; final static byte PROBLEM_TYPE= 9;
final static byte VALUE= 10; final static byte VALUE= 10;
final static byte DEPENDENT_EXPRESSION_TYPE= 11; final static byte DEPENDENT_EXPRESSION_TYPE= 11;
final static byte UNKNOWN_MEMBER= 12; final static byte UNKNOWN_MEMBER= 12;
final static byte UNKNOWN_MEMBER_CLASS_INSTANCE= 13; final static byte UNKNOWN_MEMBER_CLASS_INSTANCE= 13;
final static byte DEFERRED_CLASS_INSTANCE= 14; final static byte DEFERRED_CLASS_INSTANCE= 14;

View file

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
@ -34,11 +34,11 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
evaluation.isTypeDependent() || evaluation.isValueDependent()) { evaluation.isTypeDependent() || evaluation.isValueDependent()) {
fEvaluation= evaluation; fEvaluation= evaluation;
} else { } else {
fEvaluation= new EvalFixed(evaluation.getTypeOrFunctionSet(point), fEvaluation= new EvalFixed(evaluation.getTypeOrFunctionSet(point),
evaluation.getValueCategory(point), evaluation.getValue(point)); evaluation.getValueCategory(point), evaluation.getValue(point));
} }
} }
public CPPTemplateNonTypeArgument(IValue value, IType type) { public CPPTemplateNonTypeArgument(IValue value, IType type) {
fEvaluation = new EvalFixed(type, PRVALUE, value); fEvaluation = new EvalFixed(type, PRVALUE, value);
} }
@ -48,6 +48,11 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
return false; return false;
} }
@Override
public IType getOriginalTypeValue() {
return null;
}
@Override @Override
public boolean isNonTypeValue() { public boolean isNonTypeValue() {
return true; return true;
@ -67,12 +72,12 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
public IValue getNonTypeValue() { public IValue getNonTypeValue() {
return fEvaluation.getValue(null); return fEvaluation.getValue(null);
} }
@Override @Override
public IType getTypeOfNonTypeValue() { public IType getTypeOfNonTypeValue() {
return fEvaluation.getTypeOrFunctionSet(null); return fEvaluation.getTypeOrFunctionSet(null);
} }
@Override @Override
public boolean isPackExpansion() { public boolean isPackExpansion() {
return fEvaluation.getTypeOrFunctionSet(null) instanceof ICPPParameterPackType; return fEvaluation.getTypeOrFunctionSet(null) instanceof ICPPParameterPackType;

View file

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -22,12 +22,19 @@ import org.eclipse.core.runtime.Assert;
*/ */
public class CPPTemplateTypeArgument implements ICPPTemplateArgument { public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
private final IType fType; private final IType fType;
private final IType fOriginalType;
public CPPTemplateTypeArgument(IType type) { public CPPTemplateTypeArgument(IType type) {
Assert.isNotNull(type); this(type, type);
fType= type;
} }
public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {
Assert.isNotNull(simplifiedType);
Assert.isNotNull(originalType);
fType= simplifiedType;
fOriginalType= originalType;
}
@Override @Override
public boolean isTypeValue() { public boolean isTypeValue() {
return true; return true;
@ -43,21 +50,26 @@ public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
return fType; return fType;
} }
@Override
public IType getOriginalTypeValue() {
return fOriginalType;
}
@Override @Override
public ICPPEvaluation getNonTypeEvaluation() { public ICPPEvaluation getNonTypeEvaluation() {
return null; return null;
} }
@Override @Override
public IValue getNonTypeValue() { public IValue getNonTypeValue() {
return null; return null;
} }
@Override @Override
public IType getTypeOfNonTypeValue() { public IType getTypeOfNonTypeValue() {
return null; return null;
} }
@Override @Override
public boolean isPackExpansion() { public boolean isPackExpansion() {
return fType instanceof ICPPParameterPackType; return fType instanceof ICPPParameterPackType;

View file

@ -174,8 +174,8 @@ public class CPPTemplates {
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) { boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
try { try {
// Add default arguments, if necessary.
ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args); ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args);
// Add default arguments, if necessary.
arguments= addDefaultArguments(template, arguments, point); arguments= addDefaultArguments(template, arguments, point);
if (arguments == null) if (arguments == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point); return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
@ -208,7 +208,7 @@ public class CPPTemplates {
} }
if (i < numArgs) { if (i < numArgs) {
ICPPTemplateArgument arg= arguments[i]; ICPPTemplateArgument arg= arguments[i];
ICPPTemplateArgument newArg = CPPTemplates.matchTemplateParameterAndArgument(param, arg, map, point); ICPPTemplateArgument newArg = matchTemplateParameterAndArgument(param, arg, map, point);
if (newArg == null) if (newArg == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point); return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
if (newArg != arg) { if (newArg != arg) {
@ -239,7 +239,7 @@ public class CPPTemplates {
return prim; return prim;
if (!isExplicitSpecialization) { if (!isExplicitSpecialization) {
IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDefinition, point); IBinding result= selectSpecialization(template, arguments, isDefinition, point);
if (result != null) if (result != null)
return result; return result;
} }
@ -314,7 +314,7 @@ public class CPPTemplates {
} }
IBinding owner= template.getOwner(); IBinding owner= template.getOwner();
instance = CPPTemplates.createInstance(owner, template, map, arguments, point); instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance); addInstance(template, arguments, instance);
return instance; return instance;
} }
@ -354,7 +354,7 @@ public class CPPTemplates {
} }
IBinding owner= template.getOwner(); IBinding owner= template.getOwner();
instance = CPPTemplates.createInstance(owner, template, map, arguments, point); instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance); addInstance(template, arguments, instance);
return instance; return instance;
} }
@ -423,7 +423,7 @@ public class CPPTemplates {
if (tpars[tparCount - 1].isParameterPack()) if (tpars[tparCount - 1].isParameterPack())
return arguments; return arguments;
if (havePackExpansion && tparCount+1 == argCount) if (havePackExpansion && tparCount + 1 == argCount)
return arguments; return arguments;
return null; return null;
} }
@ -476,7 +476,7 @@ public class CPPTemplates {
if (ct instanceof ICPPClassTemplatePartialSpecialization) { if (ct instanceof ICPPClassTemplatePartialSpecialization) {
args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments(); args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments();
} else { } else {
args = CPPTemplates.templateParametersAsArguments(ct.getTemplateParameters()); args = templateParametersAsArguments(ct.getTemplateParameters());
} }
return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope()); return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope());
} }
@ -741,7 +741,7 @@ public class CPPTemplates {
} else if (template instanceof ICPPFunction) { } else if (template instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) template; ICPPFunction func= (ICPPFunction) template;
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point); ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point); IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (owner instanceof ICPPClassType && template instanceof ICPPMethod) { if (owner instanceof ICPPClassType && template instanceof ICPPMethod) {
if (template instanceof ICPPConstructor) { if (template instanceof ICPPConstructor) {
@ -766,7 +766,7 @@ public class CPPTemplates {
ICPPClassTemplate template= pspec.getPrimaryClassTemplate(); ICPPClassTemplate template= pspec.getPrimaryClassTemplate();
ICPPTemplateArgument[] args = pspec.getTemplateArguments(); ICPPTemplateArgument[] args = pspec.getTemplateArguments();
template= (ICPPClassTemplate) owner.specializeMember(template, point); template= (ICPPClassTemplate) owner.specializeMember(template, point);
args= CPPTemplates.instantiateArguments(args, tpMap, -1, within, point); args= instantiateArguments(args, tpMap, -1, within, point);
spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args); spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args);
} catch (DOMException e) { } catch (DOMException e) {
} }
@ -782,13 +782,13 @@ public class CPPTemplates {
} else if (decl instanceof ICPPField) { } else if (decl instanceof ICPPField) {
final ICPPClassSpecialization within = getSpecializationContext(owner); final ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPField field= (ICPPField) decl; ICPPField field= (ICPPField) decl;
IType type= CPPTemplates.instantiateType(field.getType(), tpMap, -1, within, point); IType type= instantiateType(field.getType(), tpMap, -1, within, point);
IValue value= CPPTemplates.instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point); IValue value= instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point);
spec = new CPPFieldSpecialization(decl, owner, tpMap, type, value); spec = new CPPFieldSpecialization(decl, owner, tpMap, type, value);
} else if (decl instanceof ICPPFunction) { } else if (decl instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) decl; ICPPFunction func= (ICPPFunction) decl;
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point); ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point); IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (decl instanceof ICPPFunctionTemplate) { if (decl instanceof ICPPFunctionTemplate) {
@ -808,7 +808,7 @@ public class CPPTemplates {
spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, type, exceptionSpecs); spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, type, exceptionSpecs);
} }
} else if (decl instanceof ITypedef) { } else if (decl instanceof ITypedef) {
IType type= CPPTemplates.instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point); IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type); spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) { } else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter. // TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
@ -820,7 +820,7 @@ public class CPPTemplates {
for (IBinding delegate : delegates) { for (IBinding delegate : delegates) {
try { try {
if (delegate instanceof ICPPUnknownBinding) { if (delegate instanceof ICPPUnknownBinding) {
delegate= CPPTemplates.resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point); delegate= resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point);
} }
if (delegate instanceof CPPFunctionSet) { if (delegate instanceof CPPFunctionSet) {
for (IBinding b : ((CPPFunctionSet) delegate).getBindings()) { for (IBinding b : ((CPPFunctionSet) delegate).getBindings()) {
@ -948,7 +948,7 @@ public class CPPTemplates {
ICPPEvaluation eval = value.getEvaluation(); ICPPEvaluation eval = value.getEvaluation();
if (eval == null) if (eval == null)
return PACK_SIZE_NOT_FOUND; return PACK_SIZE_NOT_FOUND;
return ((CPPEvaluation) eval).determinePackSize(tpMap); return ((CPPEvaluation) eval).determinePackSize(tpMap);
} }
@ -998,12 +998,12 @@ public class CPPTemplates {
System.arraycopy(result, 0, newResult, 0, j); System.arraycopy(result, 0, newResult, 0, j);
result= newResult; result= newResult;
for (int k= 0; k < packSize; k++) { for (int k= 0; k < packSize; k++) {
result[j++]= CPPTemplates.instantiateType(origType, tpMap, k, within, point); result[j++]= instantiateType(origType, tpMap, k, within, point);
} }
continue; continue;
} }
} else { } else {
newType = CPPTemplates.instantiateType(origType, tpMap, packOffset, within, point); newType = instantiateType(origType, tpMap, packOffset, within, point);
} }
if (result != types) { if (result != types) {
result[j++]= newType; result[j++]= newType;
@ -1043,14 +1043,14 @@ public class CPPTemplates {
ICPPTemplateArgument[] newResult= new ICPPTemplateArgument[args.length + resultShift + shift]; ICPPTemplateArgument[] newResult= new ICPPTemplateArgument[args.length + resultShift + shift];
System.arraycopy(result, 0, newResult, 0, i + resultShift); System.arraycopy(result, 0, newResult, 0, i + resultShift);
for (int j= 0; j < packSize; j++) { for (int j= 0; j < packSize; j++) {
newResult[i + resultShift + j]= CPPTemplates.instantiateArgument(origArg, tpMap, j, within, point); newResult[i + resultShift + j]= instantiateArgument(origArg, tpMap, j, within, point);
} }
result= newResult; result= newResult;
resultShift += shift; resultShift += shift;
continue; continue;
} }
} else { } else {
newArg = CPPTemplates.instantiateArgument(origArg, tpMap, packOffset, within, point); newArg = instantiateArgument(origArg, tpMap, packOffset, within, point);
} }
if (result != args) { if (result != args) {
result[i + resultShift]= newArg; result[i + resultShift]= newArg;
@ -1243,7 +1243,7 @@ public class CPPTemplates {
} }
} }
public static IType resolveTemplateTypeParameter(final ICPPTemplateParameter tpar, public static IType resolveTemplateTypeParameter(final ICPPTemplateParameter tpar,
ICPPTemplateParameterMap tpMap, int packOffset, IASTNode point) { ICPPTemplateParameterMap tpMap, int packOffset, IASTNode point) {
ICPPTemplateArgument arg= null; ICPPTemplateArgument arg= null;
if (tpar.isParameterPack()) { if (tpar.isParameterPack()) {
@ -1262,7 +1262,7 @@ public class CPPTemplates {
} }
if (arg != null) { if (arg != null) {
IType t= arg.getTypeValue(); IType t= arg.getOriginalTypeValue();
if (t != null) if (t != null)
return t; return t;
} }
@ -1480,7 +1480,7 @@ public class CPPTemplates {
while(true) { while(true) {
ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters(); ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters();
for (ICPPASTTemplateParameter par : pars) { for (ICPPASTTemplateParameter par : pars) {
IASTName name= CPPTemplates.getTemplateParameterName(par); IASTName name= getTemplateParameterName(par);
if (name != null) if (name != null)
set.put(name.getLookupKey()); set.put(name.getLookupKey());
} }
@ -2190,7 +2190,7 @@ public class CPPTemplates {
if (map != null && pType != null) { if (map != null && pType != null) {
pType= instantiateType(pType, map, -1, null, point); pType= instantiateType(pType, map, -1, null, point);
} }
if (argType instanceof ICPPUnknownType) { if (argType instanceof ICPPUnknownType) {
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), pType); return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), pType);
} }
@ -2258,7 +2258,7 @@ public class CPPTemplates {
/** /**
* Converts the template argument <code>arg</code> to match the parameter type * Converts the template argument <code>arg</code> to match the parameter type
* <code>paramType</code> or returns <code>null</code>, if this violates the rules * <code>paramType</code> or returns <code>null</code>, if this violates the rules
* specified in 14.3.2 - 5. * specified in 14.3.2 - 5.
* @throws DOMException * @throws DOMException
*/ */
@ -2275,7 +2275,7 @@ public class CPPTemplates {
if (p.isSameType(a)) if (p.isSameType(a))
return arg; return arg;
} }
if (a instanceof FunctionSetType) { if (a instanceof FunctionSetType) {
if (p instanceof IPointerType) { if (p instanceof IPointerType) {
p= ((IPointerType) p).getType(); p= ((IPointerType) p).getType();
@ -2294,7 +2294,7 @@ public class CPPTemplates {
Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN, Context.ORDINARY, point); Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN, Context.ORDINARY, point);
if (cost == null || !cost.converts()) if (cost == null || !cost.converts())
return null; return null;
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), paramType); return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), paramType);
} }
@ -2425,22 +2425,22 @@ public class CPPTemplates {
} }
return unknown; return unknown;
} }
private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap, private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap,
int packOffset, ICPPClassSpecialization within, IASTNode point) throws DOMException { int packOffset, ICPPClassSpecialization within, IASTNode point) throws DOMException {
final IType ot0= unknown.getOwnerType(); final IType ot0= unknown.getOwnerType();
if (ot0 == null) if (ot0 == null)
return unknown; return unknown;
IBinding result = unknown; IBinding result = unknown;
IType ot1 = CPPTemplates.instantiateType(ot0, tpMap, packOffset, within, point); IType ot1 = instantiateType(ot0, tpMap, packOffset, within, point);
if (ot1 != null) { if (ot1 != null) {
ot1 = SemanticUtil.getUltimateType(ot1, false); ot1 = SemanticUtil.getUltimateType(ot1, false);
if (ot1 instanceof ICPPUnknownType) { if (ot1 instanceof ICPPUnknownType) {
if (unknown instanceof ICPPUnknownMemberClassInstance) { if (unknown instanceof ICPPUnknownMemberClassInstance) {
ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown; ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown;
ICPPTemplateArgument[] args0 = ucli.getArguments(); ICPPTemplateArgument[] args0 = ucli.getArguments();
ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments(args0, tpMap, packOffset, within, point); ICPPTemplateArgument[] args1 = instantiateArguments(args0, tpMap, packOffset, within, point);
if (args0 != args1 || !ot1.isSameType(ot0)) { if (args0 != args1 || !ot1.isSameType(ot0)) {
args1= SemanticUtil.getSimplifiedArguments(args1); args1= SemanticUtil.getSimplifiedArguments(args1);
result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1); result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1);
@ -2457,7 +2457,7 @@ public class CPPTemplates {
if (s != null) { if (s != null) {
result= CPPSemantics.resolveUnknownName(s, unknown, point); result= CPPSemantics.resolveUnknownName(s, unknown, point);
if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) { if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) {
ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments( ICPPTemplateArgument[] args1 = instantiateArguments(
((ICPPUnknownMemberClassInstance) unknown).getArguments(), tpMap, packOffset, within, point); ((ICPPUnknownMemberClassInstance) unknown).getArguments(), tpMap, packOffset, within, point);
if (result instanceof ICPPClassTemplate) { if (result instanceof ICPPClassTemplate) {
result = instantiate((ICPPClassTemplate) result, args1, point); result = instantiate((ICPPClassTemplate) result, args1, point);
@ -2477,7 +2477,7 @@ public class CPPTemplates {
ICPPTemplateArgument[] arguments = dci.getTemplateArguments(); ICPPTemplateArgument[] arguments = dci.getTemplateArguments();
ICPPTemplateArgument[] newArgs; ICPPTemplateArgument[] newArgs;
try { try {
newArgs = CPPTemplates.instantiateArguments(arguments, tpMap, packOffset, within, point); newArgs = instantiateArguments(arguments, tpMap, packOffset, within, point);
} catch (DOMException e) { } catch (DOMException e) {
return e.getProblem(); return e.getProblem();
} }

View file

@ -13,6 +13,8 @@ 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.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
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.getNestedType;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
@ -126,15 +128,6 @@ public class EvalID extends CPPEvaluation {
@Override @Override
public IValue getValue(IASTNode point) { public IValue getValue(IASTNode point) {
// Name lookup is not needed here because it was already done in the "instantiate" method. // Name lookup is not needed here because it was already done in the "instantiate" method.
// IBinding nameOwner = fNameOwner;
// if (nameOwner == null && fFieldOwner != null)
// nameOwner = (IBinding) fFieldOwner.getTypeOrFunctionSet(point);
//
// if (nameOwner instanceof ICPPClassType) {
// ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, fTemplateArgs, point);
// if (eval != null)
// return eval.getValue(point);
// }
return Value.create(this); return Value.create(this);
} }
@ -294,7 +287,7 @@ public class EvalID extends CPPEvaluation {
} else if (nameOwner instanceof IType) { } else if (nameOwner instanceof IType) {
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point); IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
if (type instanceof IBinding) if (type instanceof IBinding)
nameOwner = (IBinding) type; nameOwner = (IBinding) getNestedType(type, TDEF);
} }
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding) if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)

View file

@ -78,14 +78,14 @@ public class SemanticUtil {
// Resolve typedefs. // Resolve typedefs.
public static final int TDEF = 0x01; public static final int TDEF = 0x01;
// Resolve typedefs, but only if necessary for a nested type transformation. // Resolve typedefs, but only if necessary for a nested type transformation.
public static final int COND_TDEF = 0x02; public static final int COND_TDEF = 0x02;
public static final int REF = 0x04; public static final int REF = 0x04;
public static final int CVTYPE = 0x08; public static final int CVTYPE = 0x08;
public static final int ALLCVQ = 0x10; public static final int ALLCVQ = 0x10;
public static final int PTR = 0x20; public static final int PTR = 0x20;
public static final int MPTR = 0x40; public static final int MPTR = 0x40;
public static final int ARRAY = 0x80; public static final int ARRAY = 0x80;
static { static {
final int OPERATOR_SPC= OPERATOR_CHARS.length + 1; final int OPERATOR_SPC= OPERATOR_CHARS.length + 1;
for (OverloadableOperator op : OverloadableOperator.values()) { for (OverloadableOperator op : OverloadableOperator.values()) {
@ -93,7 +93,7 @@ public class SemanticUtil {
cas.put(CharArrayUtils.subarray(name, OPERATOR_SPC, name.length)); cas.put(CharArrayUtils.subarray(name, OPERATOR_SPC, name.length));
} }
} }
/** /**
* Returns an array of ICPPMethod objects representing all conversion operators * Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class. This does not include inherited methods. Conversion * declared by the specified class. This does not include inherited methods. Conversion
@ -116,7 +116,7 @@ public class SemanticUtil {
} }
return methods; return methods;
} }
/** /**
* Returns an array of ICPPMethod objects representing all conversion operators * Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class and its ancestors. This includes inherited * declared by the specified class and its ancestors. This includes inherited
@ -132,7 +132,7 @@ public class SemanticUtil {
} }
return methods; return methods;
} }
/** /**
* @param root the class to start at * @param root the class to start at
* @return the root and all its ancestor classes * @return the root and all its ancestor classes
@ -147,7 +147,7 @@ public class SemanticUtil {
ObjectSet<ICPPClassType> next= new ObjectSet<ICPPClassType>(2); ObjectSet<ICPPClassType> next= new ObjectSet<ICPPClassType>(2);
for (int i = 0; i < current.size(); i++) { for (int i = 0; i < current.size(); i++) {
ICPPClassType clazz= current.keyAt(i); ICPPClassType clazz= current.keyAt(i);
done.put(clazz); done.put(clazz);
for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) { for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) {
@ -181,21 +181,21 @@ public class SemanticUtil {
} }
return false; return false;
} }
public static CVQualifier getCVQualifier(IType t) { public static CVQualifier getCVQualifier(IType t) {
if (t instanceof IQualifierType) { if (t instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) t; IQualifierType qt= (IQualifierType) t;
return qt.isConst() return qt.isConst()
? qt.isVolatile() ? CONST_VOLATILE : CONST ? qt.isVolatile() ? CONST_VOLATILE : CONST
: qt.isVolatile() ? VOLATILE : NONE; : qt.isVolatile() ? VOLATILE : NONE;
} }
if (t instanceof IPointerType) { if (t instanceof IPointerType) {
IPointerType pt= (IPointerType) t; IPointerType pt= (IPointerType) t;
return pt.isConst() return pt.isConst()
? pt.isVolatile() ? pt.isVolatile()
? pt.isRestrict() ? CONST_VOLATILE_RESTRICT : CONST_VOLATILE ? pt.isRestrict() ? CONST_VOLATILE_RESTRICT : CONST_VOLATILE
: pt.isRestrict() ? CONST_RESTRICT : CONST : pt.isRestrict() ? CONST_RESTRICT : CONST
: pt.isVolatile() : pt.isVolatile()
? pt.isRestrict() ? VOLATILE_RESTRICT : VOLATILE ? pt.isRestrict() ? VOLATILE_RESTRICT : VOLATILE
: pt.isRestrict() ? RESTRICT : NONE; : pt.isRestrict() ? RESTRICT : NONE;
} }
@ -204,7 +204,7 @@ public class SemanticUtil {
} }
return NONE; return NONE;
} }
/** /**
* Descends into type containers, stopping at pointer-to-member types if * Descends into type containers, stopping at pointer-to-member types if
* specified. * specified.
@ -216,7 +216,7 @@ public class SemanticUtil {
final int options = TDEF | ALLCVQ | PTR | ARRAY | REF; final int options = TDEF | ALLCVQ | PTR | ARRAY | REF;
return getNestedType(type, stopAtPointerToMember ? options : (options | MPTR)); return getNestedType(type, stopAtPointerToMember ? options : (options | MPTR));
} }
/** /**
* Descends into type containers, stopping at array, pointer or * Descends into type containers, stopping at array, pointer or
* pointer-to-member types. * pointer-to-member types.
@ -273,10 +273,10 @@ public class SemanticUtil {
beforeTypedefs = null; beforeTypedefs = null;
} else if (tdef || cond_tdef) { } else if (tdef || cond_tdef) {
t= getNestedType(qttgt, options); t= getNestedType(qttgt, options);
if (t == qttgt) if (t == qttgt)
return qt; return qt;
return addQualifiers(t, qt.isConst(), qt.isVolatile(), false); return addQualifiers(t, qt.isConst(), qt.isVolatile(), false);
} }
} else if (type instanceof IArrayType) { } else if (type instanceof IArrayType) {
final IArrayType atype= (IArrayType) type; final IArrayType atype= (IArrayType) type;
if ((options & ARRAY) != 0) { if ((options & ARRAY) != 0) {
@ -298,7 +298,7 @@ public class SemanticUtil {
// A typedef within the reference type can influence whether the reference is lvalue or rvalue // A typedef within the reference type can influence whether the reference is lvalue or rvalue
IType nested= rt.getType(); IType nested= rt.getType();
IType newNested = getNestedType(nested, TDEF); IType newNested = getNestedType(nested, TDEF);
if (nested == newNested) if (nested == newNested)
return type; return type;
return replaceNestedType((ITypeContainer) rt, newNested); return replaceNestedType((ITypeContainer) rt, newNested);
} }
@ -310,7 +310,7 @@ public class SemanticUtil {
} }
return type; return type;
} }
type= t; type= t;
} }
} }
@ -331,7 +331,7 @@ public class SemanticUtil {
return type; return type;
} }
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs()); return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
} }
if (type instanceof ITypedef) { if (type instanceof ITypedef) {
IType t= ((ITypedef) type).getType(); IType t= ((ITypedef) type).getType();
@ -342,31 +342,31 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) { if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type; final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType(); final IType nestedType= tc.getType();
if (nestedType == null) if (nestedType == null)
return type; return type;
IType newType= getSimplifiedType(nestedType); IType newType= getSimplifiedType(nestedType);
if (newType != nestedType) { if (newType != nestedType) {
return replaceNestedType(tc, newType); return replaceNestedType(tc, newType);
} }
return type; return type;
} }
return type; return type;
} }
static boolean isSimplified(IType type) { static boolean isSimplified(IType type) {
if (type instanceof ICPPFunctionType) { if (type instanceof ICPPFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type; final ICPPFunctionType ft = (ICPPFunctionType) type;
if (!isSimplified(ft.getReturnType())) if (!isSimplified(ft.getReturnType()))
return false; return false;
IType[] ps = ft.getParameterTypes(); IType[] ps = ft.getParameterTypes();
for (IType p : ps) { for (IType p : ps) {
if (!isSimplified(p)) if (!isSimplified(p))
return false; return false;
} }
return true; return true;
} }
if (type instanceof ITypedef) { if (type instanceof ITypedef) {
return false; return false;
} }
@ -379,7 +379,7 @@ public class SemanticUtil {
public static IType replaceNestedType(ITypeContainer type, IType newNestedType) { public static IType replaceNestedType(ITypeContainer type, IType newNestedType) {
if (newNestedType == null) if (newNestedType == null)
return type; return type;
// Bug 249085 make sure not to add unnecessary qualifications // Bug 249085 make sure not to add unnecessary qualifications
if (type instanceof IQualifierType) { if (type instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) type; IQualifierType qt= (IQualifierType) type;
@ -393,9 +393,9 @@ public class SemanticUtil {
/** /**
* Replaces the given type or its nested type with a typedef if that type is the same as * Replaces the given type or its nested type with a typedef if that type is the same as
* the type the typedef resolves to. * the type the typedef resolves to.
* *
* @param type the type subject to substitution * @param type the type subject to substitution
* @param typedefType the type possibly containing the typedef as its nested type. * @param typedefType the type possibly containing the typedef as its nested type.
* @return the given type with the nested type replaced by the typedef, or {@code null} if * @return the given type with the nested type replaced by the typedef, or {@code null} if
* the typedefType doesn't contain a typedef or the nested type doesn't match the typedef. * the typedefType doesn't contain a typedef or the nested type doesn't match the typedef.
@ -439,7 +439,7 @@ public class SemanticUtil {
public static IType mapToAST(IType type, IASTNode node) { public static IType mapToAST(IType type, IASTNode node) {
if (node == null) if (node == null)
return type; return type;
if (type instanceof IFunctionType) { if (type instanceof IFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type; final ICPPFunctionType ft = (ICPPFunctionType) type;
final IType r = ft.getReturnType(); final IType r = ft.getReturnType();
@ -452,13 +452,13 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) { if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type; final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType(); final IType nestedType= tc.getType();
if (nestedType == null) if (nestedType == null)
return type; return type;
IType newType= mapToAST(nestedType, node); IType newType= mapToAST(nestedType, node);
if (newType != nestedType) { if (newType != nestedType) {
return replaceNestedType(tc, newType); return replaceNestedType(tc, newType);
} }
return type; return type;
} else if (type instanceof ICPPClassType && type instanceof IIndexBinding) { } else if (type instanceof ICPPClassType && type instanceof IIndexBinding) {
IASTTranslationUnit tu = node.getTranslationUnit(); IASTTranslationUnit tu = node.getTranslationUnit();
@ -515,7 +515,7 @@ public class SemanticUtil {
final IType type= arg.getTypeValue(); final IType type= arg.getTypeValue();
final IType newType= getSimplifiedType(type); final IType newType= getSimplifiedType(type);
if (newType != type) { if (newType != type) {
return new CPPTemplateTypeArgument(newType); return new CPPTemplateTypeArgument(newType, arg.getOriginalTypeValue());
} }
} }
return arg; return arg;
@ -535,17 +535,17 @@ public class SemanticUtil {
return baseType; return baseType;
} else if (baseType instanceof ICPPPointerToMemberType) { } else if (baseType instanceof ICPPPointerToMemberType) {
ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType; ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) { || (restrict && !pt.isRestrict())) {
return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(), return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict()); cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
} }
return baseType; return baseType;
} else if (baseType instanceof IPointerType) { } else if (baseType instanceof IPointerType) {
IPointerType pt= (IPointerType) baseType; IPointerType pt= (IPointerType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) { || (restrict && !pt.isRestrict())) {
return new CPPPointerType(pt.getType(), return new CPPPointerType(pt.getType(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict()); cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
} }
return baseType; return baseType;
@ -562,7 +562,7 @@ public class SemanticUtil {
} else if (baseType == null) { } else if (baseType == null) {
return null; return null;
} }
return new CPPQualifierType(baseType, cnst, vol); return new CPPQualifierType(baseType, cnst, vol);
} }
return baseType; return baseType;
@ -590,7 +590,7 @@ public class SemanticUtil {
} }
} else if (owner1 instanceof ICPPNamespace) { } else if (owner1 instanceof ICPPNamespace) {
if (owner2 instanceof ICPPNamespace) { if (owner2 instanceof ICPPNamespace) {
if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray())) if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
return false; return false;
return isSameOwner(owner1.getOwner(), owner2.getOwner()); return isSameOwner(owner1.getOwner(), owner2.getOwner());
} }
@ -611,7 +611,7 @@ public class SemanticUtil {
public static boolean isEmptyParameterList(IType[] parameters) { public static boolean isEmptyParameterList(IType[] parameters) {
if (parameters.length == 0) { if (parameters.length == 0) {
return true; return true;
} }
if (parameters.length == 1 && isVoidType(parameters[0])) { if (parameters.length == 1 && isVoidType(parameters[0])) {
return true; return true;
} }
@ -629,28 +629,28 @@ public class SemanticUtil {
public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) { public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) {
return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<Object>(), type, baseClass, point); return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<Object>(), type, baseClass, point);
} }
private static final int calculateInheritanceDepth(int maxdepth, Set<Object> hashSet, IType type, IType baseClass, IASTNode point) { private static final int calculateInheritanceDepth(int maxdepth, Set<Object> hashSet, IType type, IType baseClass, IASTNode point) {
if (type == baseClass || type.isSameType(baseClass)) { if (type == baseClass || type.isSameType(baseClass)) {
return 0; return 0;
} }
if (maxdepth > 0 && type instanceof ICPPClassType && baseClass instanceof ICPPClassType) { if (maxdepth > 0 && type instanceof ICPPClassType && baseClass instanceof ICPPClassType) {
ICPPClassType clazz = (ICPPClassType) type; ICPPClassType clazz = (ICPPClassType) type;
if (clazz instanceof ICPPDeferredClassInstance) { if (clazz instanceof ICPPDeferredClassInstance) {
clazz= (ICPPClassType) ((ICPPDeferredClassInstance) clazz).getSpecializedBinding(); clazz= (ICPPClassType) ((ICPPDeferredClassInstance) clazz).getSpecializedBinding();
} }
for (ICPPBase cppBase : ClassTypeHelper.getBases(clazz, point)) { for (ICPPBase cppBase : ClassTypeHelper.getBases(clazz, point)) {
IBinding base= cppBase.getBaseClass(); IBinding base= cppBase.getBaseClass();
if (base instanceof IType && hashSet.add(base)) { if (base instanceof IType && hashSet.add(base)) {
IType tbase= (IType) base; IType tbase= (IType) base;
if (tbase.isSameType(baseClass) || if (tbase.isSameType(baseClass) ||
(baseClass instanceof ICPPSpecialization && // allow some flexibility with templates (baseClass instanceof ICPPSpecialization && // allow some flexibility with templates
((IType)((ICPPSpecialization) baseClass).getSpecializedBinding()).isSameType(tbase))) { ((IType)((ICPPSpecialization) baseClass).getSpecializedBinding()).isSameType(tbase))) {
return 1; return 1;
} }
if (tbase instanceof ICPPClassType) { if (tbase instanceof ICPPClassType) {
int n= calculateInheritanceDepth(maxdepth - 1, hashSet, tbase, baseClass, point); int n= calculateInheritanceDepth(maxdepth - 1, hashSet, tbase, baseClass, point);
if (n > 0) if (n > 0)
@ -659,7 +659,7 @@ public class SemanticUtil {
} }
} }
} }
return -1; return -1;
} }
@ -668,14 +668,14 @@ public class SemanticUtil {
final ICPPFunctionType ft = (ICPPFunctionType) type; final ICPPFunctionType ft = (ICPPFunctionType) type;
if (containsUniqueTypeForParameterPack(ft.getReturnType())) if (containsUniqueTypeForParameterPack(ft.getReturnType()))
return true; return true;
for (IType pt : ft.getParameterTypes()) { for (IType pt : ft.getParameterTypes()) {
if (containsUniqueTypeForParameterPack(pt)) if (containsUniqueTypeForParameterPack(pt))
return true; return true;
} }
return false; return false;
} }
if (type instanceof ICPPPointerToMemberType) { if (type instanceof ICPPPointerToMemberType) {
if (containsUniqueTypeForParameterPack(((ICPPPointerToMemberType) type).getMemberOfClass())) if (containsUniqueTypeForParameterPack(((ICPPPointerToMemberType) type).getMemberOfClass()))
return true; return true;
@ -688,7 +688,7 @@ public class SemanticUtil {
return true; return true;
} }
} }
if (type instanceof ICPPTemplateInstance) { if (type instanceof ICPPTemplateInstance) {
ICPPTemplateArgument[] args = ((ICPPTemplateInstance) type).getTemplateArguments(); ICPPTemplateArgument[] args = ((ICPPTemplateInstance) type).getTemplateArguments();
for (ICPPTemplateArgument arg : args) { for (ICPPTemplateArgument arg : args) {
@ -702,7 +702,7 @@ public class SemanticUtil {
final IType nestedType= tc.getType(); final IType nestedType= tc.getType();
return containsUniqueTypeForParameterPack(nestedType); return containsUniqueTypeForParameterPack(nestedType);
} }
if (type instanceof UniqueType) { if (type instanceof UniqueType) {
return ((UniqueType) type).isForParameterPack(); return ((UniqueType) type).isForParameterPack();
} }

View file

@ -678,11 +678,12 @@ public class TemplateArgumentDeduction {
return tval.equals(sval); return tval.equals(sval);
} }
return fromType(p.getTypeValue(), a.getTypeValue(), false, point); return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point);
} }
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException { private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {
while (p != null) { while (p != null) {
IType argumentTypeBeforeTypedefResolution = a;
while (a instanceof ITypedef) while (a instanceof ITypedef)
a = ((ITypedef) a).getType(); a = ((ITypedef) a).getType();
if (p instanceof IBasicType) { if (p instanceof IBasicType) {
@ -775,7 +776,7 @@ public class TemplateArgumentDeduction {
} }
if (a == null) if (a == null)
return false; return false;
return deduce(((ICPPTemplateParameter)p).getParameterID(), new CPPTemplateTypeArgument(a)); return deduce(((ICPPTemplateParameter) p).getParameterID(), new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution));
} else if (p instanceof ICPPTemplateInstance) { } else if (p instanceof ICPPTemplateInstance) {
if (!(a instanceof ICPPTemplateInstance)) if (!(a instanceof ICPPTemplateInstance))
return false; return false;

View file

@ -276,10 +276,11 @@ public class ASTCommenter {
} }
private static <T extends IASTNode> T getNextNodeInTu(Iterator<T> iter) { private static <T extends IASTNode> T getNextNodeInTu(Iterator<T> iter) {
if (!iter.hasNext()) { while (iter.hasNext()) {
return null; T next = iter.next();
if (next.isPartOfTranslationUnitFile())
return next;
} }
T next = iter.next(); return null;
return next.isPartOfTranslationUnitFile() ? next : getNextNodeInTu(iter);
} }
} }

View file

@ -225,10 +225,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* 133.0 - Storing template arguments via direct marshalling, bug 299911. * 133.0 - Storing template arguments via direct marshalling, bug 299911.
* 134.0 - Storing unknown bindings via direct marshalling, bug 381824. * 134.0 - Storing unknown bindings via direct marshalling, bug 381824.
* 135.0 - Changed marshalling of EvalUnary, bug 391001. * 135.0 - Changed marshalling of EvalUnary, bug 391001.
* 136.0 - Extended CPPTemplateTypeArgument to include the original type, bug 392278.
*/ */
private static final int MIN_SUPPORTED_VERSION= version(135, 0); private static final int MIN_SUPPORTED_VERSION= version(136, 0);
private static final int MAX_SUPPORTED_VERSION= version(135, Short.MAX_VALUE); private static final int MAX_SUPPORTED_VERSION= version(136, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(135, 0); private static final int DEFAULT_VERSION = version(136, 0);
private static int version(int major, int minor) { private static int version(int major, int minor) {
return (major << 16) + minor; return (major << 16) + minor;

View file

@ -190,6 +190,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
arg.getNonTypeEvaluation().marshal(this, true); arg.getNonTypeEvaluation().marshal(this, true);
} else { } else {
marshalType(arg.getTypeValue()); marshalType(arg.getTypeValue());
marshalType(arg.getOriginalTypeValue());
} }
} }
@ -200,7 +201,9 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
return new CPPTemplateNonTypeArgument((ICPPEvaluation) unmarshalEvaluation(), null); return new CPPTemplateNonTypeArgument((ICPPEvaluation) unmarshalEvaluation(), null);
} else { } else {
fPos--; fPos--;
return new CPPTemplateTypeArgument(unmarshalType()); IType type = unmarshalType();
IType originalType = unmarshalType();
return new CPPTemplateTypeArgument(type, originalType);
} }
} }

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * QNX - Initial API and implementation
* IBM Corporation * IBM Corporation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -22,31 +22,28 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
class PDOMCPPField extends PDOMCPPVariable implements ICPPField { class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
public PDOMCPPField(PDOMLinkage linkage, PDOMNode parent, ICPPField field) public PDOMCPPField(PDOMLinkage linkage, PDOMNode parent, ICPPField field)
throws CoreException { throws CoreException {
super(linkage, parent, field); super(linkage, parent, field);
} }
public PDOMCPPField(PDOMLinkage linkage, long bindingRecord) { public PDOMCPPField(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord); super(linkage, bindingRecord);
} }
// @Override
@Override @Override
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;
} }
// @Override
@Override @Override
public int getNodeType() { public int getNodeType() {
return IIndexCPPBindingConstants.CPPFIELD; return IIndexCPPBindingConstants.CPPFIELD;
} }
@Override @Override
public ICPPClassType getClassOwner() { public ICPPClassType getClassOwner() {
return (ICPPClassType) getOwner(); return (ICPPClassType) getOwner();
@ -57,37 +54,32 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATIONS)); return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATIONS));
} }
// @Override
@Override @Override
public boolean isMutable() { public boolean isMutable() {
return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET); return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET);
} }
// @Override
@Override @Override
public boolean isAuto() { public boolean isAuto() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6
return false; return false;
} }
// @Override
@Override @Override
public boolean isExtern() { public boolean isExtern() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6
return false; return false;
} }
// @Override
@Override @Override
public boolean isExternC() { public boolean isExternC() {
return false; return false;
} }
// @Override
@Override @Override
public boolean isRegister() { public boolean isRegister() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6
return false; return false;
} }
@Override @Override

View file

@ -1,25 +1,33 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2011 QNX Software Systems and others. * Copyright (c) 2000, 2012 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* IBM Corporation * IBM Corporation
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion) * Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core; package org.eclipse.cdt.core;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class CCorePreferenceConstants { public class CCorePreferenceConstants {
/** /**
* <pre> * <pre>
* RECOGNIZED OPTIONS: * RECOGNIZED OPTIONS:
@ -33,9 +41,9 @@ public class CCorePreferenceConstants {
* by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will * by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will
* be detected either for tag "ToDo" or "ToDo:"). * be detected either for tag "ToDo" or "ToDo:").
* - option id: "org.eclipse.cdt.core.taskTags" * - option id: "org.eclipse.cdt.core.taskTags"
* - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
* - default: "" * - default: ""
* *
* Define the Automatic Task Priorities * Define the Automatic Task Priorities
* In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low) * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
* of the task markers issued by the translation. * of the task markers issued by the translation.
@ -54,17 +62,17 @@ public class CCorePreferenceConstants {
* Default task tag * Default task tag
*/ */
public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
/** /**
* List of tags provided by default * List of tags provided by default
* @since 5.1 * @since 5.1
*/ */
public static final String DEFAULT_TASK_TAGS = DEFAULT_TASK_TAG + ",FIXME,XXX"; //$NON-NLS-1$ public static final String DEFAULT_TASK_TAGS = DEFAULT_TASK_TAG + ",FIXME,XXX"; //$NON-NLS-1$
/** /**
* Possible configurable option value for TODO_TASK_PRIORITIES. * Possible configurable option value for TODO_TASK_PRIORITIES.
*/ */
public static final String TASK_PRIORITY_NORMAL = "normal"; //$NON-NLS-1$ public static final String TASK_PRIORITY_NORMAL = "normal"; //$NON-NLS-1$
/** /**
* Possible configurable option value for TODO_TASK_PRIORITIES. * Possible configurable option value for TODO_TASK_PRIORITIES.
*/ */
@ -97,7 +105,7 @@ public class CCorePreferenceConstants {
* Active code formatter ID. * Active code formatter ID.
*/ */
public static final String CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".code_formatter"; //$NON-NLS-1$ public static final String CODE_FORMATTER = CCorePlugin.PLUGIN_ID + ".code_formatter"; //$NON-NLS-1$
/** /**
* Default code formatter * Default code formatter
*/ */
@ -117,7 +125,7 @@ public class CCorePreferenceConstants {
* Absolute maximum size of the index-db in megabytes. * Absolute maximum size of the index-db in megabytes.
*/ */
public static final String MAX_INDEX_DB_CACHE_SIZE_MB = CCorePlugin.PLUGIN_ID + ".maxIndexDBCacheSizeMB"; //$NON-NLS-1$ public static final String MAX_INDEX_DB_CACHE_SIZE_MB = CCorePlugin.PLUGIN_ID + ".maxIndexDBCacheSizeMB"; //$NON-NLS-1$
/** /**
* Default absolute maximum size of the index-db in megabytes. * Default absolute maximum size of the index-db in megabytes.
*/ */
@ -131,7 +139,7 @@ public class CCorePreferenceConstants {
public static final String FILE_PATH_CANONICALIZATION = CCorePlugin.PLUGIN_ID + ".path_canonicalization"; //$NON-NLS-1$ public static final String FILE_PATH_CANONICALIZATION = CCorePlugin.PLUGIN_ID + ".path_canonicalization"; //$NON-NLS-1$
/** /**
* Workspace-wide language mappings. * Workspace-wide language mappings.
*/ */
public static final String WORKSPACE_LANGUAGE_MAPPINGS = CCorePlugin.PLUGIN_ID + ".workspaceLanguageMappings"; //$NON-NLS-1$ public static final String WORKSPACE_LANGUAGE_MAPPINGS = CCorePlugin.PLUGIN_ID + ".workspaceLanguageMappings"; //$NON-NLS-1$
@ -144,7 +152,7 @@ public class CCorePreferenceConstants {
* Attempt to show source files for executable binaries. * Attempt to show source files for executable binaries.
*/ */
public static final String SHOW_SOURCE_FILES_IN_BINARIES = CCorePlugin.PLUGIN_ID + ".showSourceFilesInBinaries"; //$NON-NLS-1$ public static final String SHOW_SOURCE_FILES_IN_BINARIES = CCorePlugin.PLUGIN_ID + ".showSourceFilesInBinaries"; //$NON-NLS-1$
/** /**
* Show source roots at the top level of projects. * Show source roots at the top level of projects.
* @since 5.2 * @since 5.2
@ -153,17 +161,110 @@ public class CCorePreferenceConstants {
/** /**
* "Build All Configurations" preference key. * "Build All Configurations" preference key.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled"; //$NON-NLS-1$ public static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled"; //$NON-NLS-1$
/** /**
* Preference key for "build only if resources in (related) projects are modified". * Preference key for "build only if resources in (related) projects are modified".
* *
* @since 5.3 * @since 5.3
*/ */
public static final String PREF_BUILD_CONFIGS_RESOURCE_CHANGES = "build.proj.ref.configs.enabled"; //$NON-NLS-1$ public static final String PREF_BUILD_CONFIGS_RESOURCE_CHANGES = "build.proj.ref.configs.enabled"; //$NON-NLS-1$
/**
* Returns the node in the preference in the given context.
* @param key The preference key.
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should
* be avoided.
* @return Returns the node matching the given context.
*/
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
IEclipsePreferences node = null;
if (project != null) {
node = new ProjectScope(project.getProject()).getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
}
node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
node = ConfigurationScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
return DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the current value for the string.
* @since 5.5
*/
public static String getPreference(String key, ICProject project) {
return getPreference(key, project, null);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static String getPreference(String key, ICProject project, String defaultValue) {
return getPreferenceNode(key, project).get(key, defaultValue);
}
/**
* Returns the integer value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static int getPreference(String key, ICProject project, int defaultValue) {
return getPreferenceNode(key, project).getInt(key, defaultValue);
}
/**
* Returns the boolean value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static boolean getPreference(String key, ICProject project, boolean defaultValue) {
return getPreferenceNode(key, project).getBoolean(key, defaultValue);
}
/**
* Returns the scopes for preference lookup.
*
* @param project a project or {@code null}
* @return the scopes for preference lookup.
* @since 5.5
*/
public static IScopeContext[] getPreferenceScopes(IProject project) {
return project != null ?
new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -1328,7 +1328,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// v.push_back(/*cursor*/); // v.push_back(/*cursor*/);
// } // }
public void testTypedefSpecialization_Bug307818() throws Exception { public void testTypedefSpecialization_Bug307818() throws Exception {
final String[] expected= { "push_back(const vector<int>::value_type & value) : void" }; final String[] expected= { "push_back(const vector<MyType>::value_type & value) : void" };
assertParameterHint(expected); assertParameterHint(expected);
} }

View file

@ -29,6 +29,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.cdt.core.CCorePreferenceConstants;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.ui.text.ICColorConstants; import org.eclipse.cdt.ui.text.ICColorConstants;
@ -39,14 +40,14 @@ import org.eclipse.cdt.internal.ui.text.spelling.SpellCheckEngine;
* Preference constants used in the CDT-UI preference store. Clients should only read the * Preference constants used in the CDT-UI preference store. Clients should only read the
* CDT-UI preference store using these values. Clients are not allowed to modify the * CDT-UI preference store using these values. Clients are not allowed to modify the
* preference store programmatically. * preference store programmatically.
* *
* The preferences defined in this file are exported in the plugin's * The preferences defined in this file are exported in the plugin's
* "preferenceTransfer" extension. If adding a new preference please * "preferenceTransfer" extension. If adding a new preference please
* also add it to one of the two if applicable: * also add it to one of the two if applicable:
* <ol> * <ol>
* <li>"Editor Appearance" - Any preference related to how the editor presents * <li>"Editor Appearance" - Any preference related to how the editor presents
* the edited code to the user.</li> * the edited code to the user.</li>
* <li>"Editor Behavior" - Any preference related to how the editor process the * <li>"Editor Behavior" - Any preference related to how the editor process the
* edited code.</li> * edited code.</li>
* </ol> * </ol>
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
@ -805,7 +806,7 @@ public class PreferenceConstants {
* @since 5.1 * @since 5.1
*/ */
public static final String OUTLINE_GROUP_MEMBERS= "org.eclipse.cdt.ui.outline.groupmembers"; //$NON-NLS-1$ public static final String OUTLINE_GROUP_MEMBERS= "org.eclipse.cdt.ui.outline.groupmembers"; //$NON-NLS-1$
/** /**
* A named preference that controls whether the Outline view should group macro definitions. * A named preference that controls whether the Outline view should group macro definitions.
* <p> * <p>
@ -832,7 +833,7 @@ public class PreferenceConstants {
* </p> * </p>
*/ */
public static final String CVIEW_GROUP_INCLUDES= "org.eclipse.cdt.ui.cview.groupincludes"; //$NON-NLS-1$ public static final String CVIEW_GROUP_INCLUDES= "org.eclipse.cdt.ui.cview.groupincludes"; //$NON-NLS-1$
/** /**
* A named preference that controls whether macro definitions should be grouped in * A named preference that controls whether macro definitions should be grouped in
* the C/C++ Projects view and the Project Explorer view. * the C/C++ Projects view and the Project Explorer view.
@ -849,22 +850,22 @@ public class PreferenceConstants {
* <p> * <p>
* Value is of type <code>Boolean</code>. * Value is of type <code>Boolean</code>.
* </p> * </p>
* *
* @since 5.0 * @since 5.0
*/ */
public static final String CVIEW_SEPARATE_HEADER_AND_SOURCE= "org.eclipse.cdt.ui.cview.separateheaderandsource"; //$NON-NLS-1$ public static final String CVIEW_SEPARATE_HEADER_AND_SOURCE= "org.eclipse.cdt.ui.cview.separateheaderandsource"; //$NON-NLS-1$
/** /**
* A named preference that controls whether the sorting order of source files should be changed * A named preference that controls whether the sorting order of source files should be changed
* in the C/C++ Projects view and the Project Explorer view when they are excluded from build. * in the C/C++ Projects view and the Project Explorer view when they are excluded from build.
* <p> * <p>
* Value is of type <code>Boolean</code>. * Value is of type <code>Boolean</code>.
* </p> * </p>
* *
* @since 5.3 * @since 5.3
*/ */
public static final String SORT_ORDER_OF_EXCLUDED_FILES= "org.eclipse.cdt.ui.cview.sortorderofexcludedfiles"; //$NON-NLS-1$ public static final String SORT_ORDER_OF_EXCLUDED_FILES= "org.eclipse.cdt.ui.cview.sortorderofexcludedfiles"; //$NON-NLS-1$
/** /**
* A named preference that controls which completion proposal categories * A named preference that controls which completion proposal categories
* have been excluded from the default proposal list. * have been excluded from the default proposal list.
@ -921,7 +922,7 @@ public class PreferenceConstants {
* </p> * </p>
*/ */
public static final String EDITOR_FOLDING_STATEMENTS = "editor_folding_statements"; //$NON-NLS-1$ public static final String EDITOR_FOLDING_STATEMENTS = "editor_folding_statements"; //$NON-NLS-1$
/** /**
* A named preference that stores the value for functions folding for the default folding provider. * A named preference that stores the value for functions folding for the default folding provider.
* <p> * <p>
@ -1025,7 +1026,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public final static String REMOVE_TRAILING_WHITESPACE = "removeTrailingWhitespace"; //$NON-NLS-1$ public final static String REMOVE_TRAILING_WHITESPACE = "removeTrailingWhitespace"; //$NON-NLS-1$
/** /**
* Preference key controlling how REMOVE_TRAILING_WHITESPACE option is applied. * Preference key controlling how REMOVE_TRAILING_WHITESPACE option is applied.
* If REMOVE_TRAILING_WHITESPACE is enabled, this option limits the scope of * If REMOVE_TRAILING_WHITESPACE is enabled, this option limits the scope of
@ -1162,14 +1163,14 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$ public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$
/** /**
* A named preference that holds the duration (in milli seconds) a content proposal may compute * A named preference that holds the duration (in milli seconds) a content proposal may compute
* until it is assumed that the proposal computer has a problem and should be disabled. * until it is assumed that the proposal computer has a problem and should be disabled.
* <p> * <p>
* Value is of type <code>long</code>. * Value is of type <code>long</code>.
* *
* @since 5.4 * @since 5.4
*/ */
public final static String CODEASSIST_PROPOSALS_TIMEOUT= "content_assist_proposals_timeout"; //$NON-NLS-1$ public final static String CODEASSIST_PROPOSALS_TIMEOUT= "content_assist_proposals_timeout"; //$NON-NLS-1$
@ -1179,7 +1180,7 @@ public class PreferenceConstants {
* Value is of type <code>String</code>. A RGB color value encoded as a string * Value is of type <code>String</code>. A RGB color value encoded as a string
* using class <code>PreferenceConverter</code> * using class <code>PreferenceConverter</code>
* </p> * </p>
* *
* @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter * @see org.eclipse.jface.preference.PreferenceConverter
* *
@ -1193,7 +1194,7 @@ public class PreferenceConstants {
* Value is of type <code>String</code>. A RGB color value encoded as a string * Value is of type <code>String</code>. A RGB color value encoded as a string
* using class <code>PreferenceConverter</code> * using class <code>PreferenceConverter</code>
* </p> * </p>
* *
* @see org.eclipse.jface.resource.StringConverter * @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter * @see org.eclipse.jface.preference.PreferenceConverter
* *
@ -1438,7 +1439,7 @@ public class PreferenceConstants {
* <p> * <p>
* Value is of type <code>Boolean</code>. * Value is of type <code>Boolean</code>.
* </p> * </p>
* *
* @since 5.3 * @since 5.3
*/ */
public static final String EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES= "markOverloadedOperatorsOccurrences"; //$NON-NLS-1$ public static final String EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES= "markOverloadedOperatorsOccurrences"; //$NON-NLS-1$
@ -1462,7 +1463,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public static final String SCALABILITY_RECONCILER = "scalability.reconciler"; //$NON-NLS-1$ public static final String SCALABILITY_RECONCILER = "scalability.reconciler"; //$NON-NLS-1$
/** /**
* A named preference that controls whether syntax coloring is disabled. * A named preference that controls whether syntax coloring is disabled.
* <p> * <p>
@ -1492,7 +1493,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public static final String SCALABILITY_ALERT = "scalability.detect"; //$NON-NLS-1$ public static final String SCALABILITY_ALERT = "scalability.detect"; //$NON-NLS-1$
/** /**
* The size of the file that will trigger scalability mode * The size of the file that will trigger scalability mode
* <p> * <p>
@ -1502,7 +1503,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public static final String SCALABILITY_NUMBER_OF_LINES = "scalability.numberOfLines"; //$NON-NLS-1$ public static final String SCALABILITY_NUMBER_OF_LINES = "scalability.numberOfLines"; //$NON-NLS-1$
/** /**
* A named preference that controls whether syntax coloring is disabled. * A named preference that controls whether syntax coloring is disabled.
* <p> * <p>
@ -1512,7 +1513,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public static final String SCALABILITY_SEMANTIC_HIGHLIGHT = "scalability.semanticHighlight"; //$NON-NLS-1$ public static final String SCALABILITY_SEMANTIC_HIGHLIGHT = "scalability.semanticHighlight"; //$NON-NLS-1$
/** /**
* A named preference that controls whether the content assist auto activation is disabled in scalability mode. * A named preference that controls whether the content assist auto activation is disabled in scalability mode.
* <p> * <p>
@ -1522,7 +1523,7 @@ public class PreferenceConstants {
* @since 5.0 * @since 5.0
*/ */
public static final String SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION = "scalability.contentAssistAutoActivation"; //$NON-NLS-1$ public static final String SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION = "scalability.contentAssistAutoActivation"; //$NON-NLS-1$
/** /**
* A named preference that controls how an include guard symbol is created. * A named preference that controls how an include guard symbol is created.
* <p> * <p>
@ -1537,24 +1538,24 @@ public class PreferenceConstants {
* The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code> * The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code>
* specifying that the include guard symbol is to be derived from * specifying that the include guard symbol is to be derived from
* the include file's name. * the include file's name.
* *
* @since 5.1 * @since 5.1
*/ */
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME = 0; public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME = 0;
/** /**
* The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code> * The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code>
* specifying that the include guard symbol is to be derived from a UUID. * specifying that the include guard symbol is to be derived from a UUID.
* *
* @since 5.1 * @since 5.1
*/ */
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_UUID = 1; public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_UUID = 1;
/** /**
* The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code> * The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code>
* specifying that the include guard symbol is to be derived from * specifying that the include guard symbol is to be derived from
* the include file's path relative to the source folder. * the include file's path relative to the source folder.
* *
* @since 5.2 * @since 5.2
*/ */
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_PATH = 2; public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_PATH = 2;
@ -1563,7 +1564,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a constant name. * A named preference that controls how capitalization of a constant name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CONSTANT_CAPITALIZATION = "nameStyle.constant.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_CONSTANT_CAPITALIZATION = "nameStyle.constant.capitalization"; //$NON-NLS-1$
@ -1571,7 +1572,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a constant name. * A named preference that controls prefix of a constant name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CONSTANT_PREFIX = "nameStyle.constant.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_CONSTANT_PREFIX = "nameStyle.constant.prefix"; //$NON-NLS-1$
@ -1579,7 +1580,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a constant name. * A named preference that controls suffix of a constant name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CONSTANT_SUFFIX = "nameStyle.constant.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_CONSTANT_SUFFIX = "nameStyle.constant.suffix"; //$NON-NLS-1$
@ -1588,7 +1589,7 @@ public class PreferenceConstants {
* of a constant name. * of a constant name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CONSTANT_WORD_DELIMITER = "nameStyle.constant.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_CONSTANT_WORD_DELIMITER = "nameStyle.constant.wordDelimiter"; //$NON-NLS-1$
@ -1597,7 +1598,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a variable name. * A named preference that controls how capitalization of a variable name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_VARIABLE_CAPITALIZATION = "nameStyle.variable.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_VARIABLE_CAPITALIZATION = "nameStyle.variable.capitalization"; //$NON-NLS-1$
@ -1605,7 +1606,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a variable name. * A named preference that controls prefix of a variable name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_VARIABLE_PREFIX = "nameStyle.variable.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_VARIABLE_PREFIX = "nameStyle.variable.prefix"; //$NON-NLS-1$
@ -1613,7 +1614,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a variable name. * A named preference that controls suffix of a variable name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_VARIABLE_SUFFIX = "nameStyle.variable.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_VARIABLE_SUFFIX = "nameStyle.variable.suffix"; //$NON-NLS-1$
@ -1622,7 +1623,7 @@ public class PreferenceConstants {
* of a variable name. * of a variable name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_VARIABLE_WORD_DELIMITER = "nameStyle.variable.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_VARIABLE_WORD_DELIMITER = "nameStyle.variable.wordDelimiter"; //$NON-NLS-1$
@ -1631,7 +1632,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a field name. * A named preference that controls how capitalization of a field name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_FIELD_CAPITALIZATION = "nameStyle.field.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_FIELD_CAPITALIZATION = "nameStyle.field.capitalization"; //$NON-NLS-1$
@ -1639,7 +1640,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a field name. * A named preference that controls prefix of a field name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_FIELD_PREFIX = "nameStyle.field.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_FIELD_PREFIX = "nameStyle.field.prefix"; //$NON-NLS-1$
@ -1647,7 +1648,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a field name. * A named preference that controls suffix of a field name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_FIELD_SUFFIX = "nameStyle.field.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_FIELD_SUFFIX = "nameStyle.field.suffix"; //$NON-NLS-1$
@ -1656,7 +1657,7 @@ public class PreferenceConstants {
* of a field name. * of a field name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_FIELD_WORD_DELIMITER = "nameStyle.field.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_FIELD_WORD_DELIMITER = "nameStyle.field.wordDelimiter"; //$NON-NLS-1$
@ -1665,7 +1666,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a method name. * A named preference that controls how capitalization of a method name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String NAME_STYLE_METHOD_CAPITALIZATION = "nameStyle.method.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_METHOD_CAPITALIZATION = "nameStyle.method.capitalization"; //$NON-NLS-1$
@ -1673,7 +1674,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a method name. * A named preference that controls prefix of a method name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String NAME_STYLE_METHOD_PREFIX = "nameStyle.method.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_METHOD_PREFIX = "nameStyle.method.prefix"; //$NON-NLS-1$
@ -1681,7 +1682,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a method name. * A named preference that controls suffix of a method name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String NAME_STYLE_METHOD_SUFFIX = "nameStyle.method.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_METHOD_SUFFIX = "nameStyle.method.suffix"; //$NON-NLS-1$
@ -1690,7 +1691,7 @@ public class PreferenceConstants {
* of a method name. * of a method name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String NAME_STYLE_METHOD_WORD_DELIMITER = "nameStyle.method.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_METHOD_WORD_DELIMITER = "nameStyle.method.wordDelimiter"; //$NON-NLS-1$
@ -1700,7 +1701,7 @@ public class PreferenceConstants {
* depends on capitalization of the method name. * depends on capitalization of the method name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_GETTER_CAPITALIZATION = "nameStyle.getter.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_GETTER_CAPITALIZATION = "nameStyle.getter.capitalization"; //$NON-NLS-1$
@ -1708,7 +1709,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name. * A named preference that controls prefix of the getter name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_GETTER_PREFIX = "nameStyle.getter.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_GETTER_PREFIX = "nameStyle.getter.prefix"; //$NON-NLS-1$
@ -1716,7 +1717,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name for a boolean field. * A named preference that controls prefix of the getter name for a boolean field.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN = "nameStyle.getter.prefixForBoolean"; //$NON-NLS-1$ public static final String NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN = "nameStyle.getter.prefixForBoolean"; //$NON-NLS-1$
@ -1724,7 +1725,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the getter name. * A named preference that controls suffix of the getter name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_GETTER_SUFFIX = "nameStyle.getter.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_GETTER_SUFFIX = "nameStyle.getter.suffix"; //$NON-NLS-1$
@ -1733,7 +1734,7 @@ public class PreferenceConstants {
* when composing the getter name from the field name. * when composing the getter name from the field name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_GETTER_WORD_DELIMITER = "nameStyle.getter.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_GETTER_WORD_DELIMITER = "nameStyle.getter.wordDelimiter"; //$NON-NLS-1$
@ -1743,7 +1744,7 @@ public class PreferenceConstants {
* depends on capitalization of the field name. * depends on capitalization of the field name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_SETTER_CAPITALIZATION = "nameStyle.setter.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_SETTER_CAPITALIZATION = "nameStyle.setter.capitalization"; //$NON-NLS-1$
@ -1751,7 +1752,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the setter name. * A named preference that controls prefix of the setter name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_SETTER_PREFIX = "nameStyle.setter.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_SETTER_PREFIX = "nameStyle.setter.prefix"; //$NON-NLS-1$
@ -1759,7 +1760,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the setter name. * A named preference that controls suffix of the setter name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_SETTER_SUFFIX = "nameStyle.setter.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_SETTER_SUFFIX = "nameStyle.setter.suffix"; //$NON-NLS-1$
@ -1768,7 +1769,7 @@ public class PreferenceConstants {
* when composing the setter name from the field name. * when composing the setter name from the field name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_SETTER_WORD_DELIMITER = "nameStyle.setter.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_SETTER_WORD_DELIMITER = "nameStyle.setter.wordDelimiter"; //$NON-NLS-1$
@ -1778,7 +1779,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name. * depends on capitalization of the class name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_SOURCE_CAPITALIZATION = "nameStyle.cpp.source.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_SOURCE_CAPITALIZATION = "nameStyle.cpp.source.capitalization"; //$NON-NLS-1$
@ -1786,7 +1787,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ source file name. * A named preference that controls prefix of the C++ source file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_SOURCE_PREFIX = "nameStyle.cpp.source.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_SOURCE_PREFIX = "nameStyle.cpp.source.prefix"; //$NON-NLS-1$
@ -1794,7 +1795,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ source file name. * A named preference that controls suffix of the C++ source file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_SOURCE_SUFFIX = "nameStyle.cpp.source.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_SOURCE_SUFFIX = "nameStyle.cpp.source.suffix"; //$NON-NLS-1$
@ -1803,7 +1804,7 @@ public class PreferenceConstants {
* when composing the C++ source file name from the class name. * when composing the C++ source file name from the class name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_SOURCE_WORD_DELIMITER = "nameStyle.cpp.source.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_SOURCE_WORD_DELIMITER = "nameStyle.cpp.source.wordDelimiter"; //$NON-NLS-1$
@ -1813,7 +1814,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name. * depends on capitalization of the class name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_HEADER_CAPITALIZATION = "nameStyle.cpp.header.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_HEADER_CAPITALIZATION = "nameStyle.cpp.header.capitalization"; //$NON-NLS-1$
@ -1821,7 +1822,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ header file name. * A named preference that controls prefix of the C++ header file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_HEADER_PREFIX = "nameStyle.cpp.header.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_HEADER_PREFIX = "nameStyle.cpp.header.prefix"; //$NON-NLS-1$
@ -1829,7 +1830,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ header file name. * A named preference that controls suffix of the C++ header file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_HEADER_SUFFIX = "nameStyle.cpp.header.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_HEADER_SUFFIX = "nameStyle.cpp.header.suffix"; //$NON-NLS-1$
@ -1838,7 +1839,7 @@ public class PreferenceConstants {
* when composing the C++ header file name from the class name. * when composing the C++ header file name from the class name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_HEADER_WORD_DELIMITER = "nameStyle.cpp.header.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_HEADER_WORD_DELIMITER = "nameStyle.cpp.header.wordDelimiter"; //$NON-NLS-1$
@ -1848,7 +1849,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name. * depends on capitalization of the class name.
* <p> * <p>
* Value is of type <code>Integer</code>. * Value is of type <code>Integer</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_TEST_CAPITALIZATION = "nameStyle.cpp.test.capitalization"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_TEST_CAPITALIZATION = "nameStyle.cpp.test.capitalization"; //$NON-NLS-1$
@ -1856,7 +1857,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ test file name. * A named preference that controls prefix of the C++ test file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_TEST_PREFIX = "nameStyle.cpp.test.prefix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_TEST_PREFIX = "nameStyle.cpp.test.prefix"; //$NON-NLS-1$
@ -1864,7 +1865,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ test file name. * A named preference that controls suffix of the C++ test file name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_TEST_SUFFIX = "nameStyle.cpp.test.suffix"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_TEST_SUFFIX = "nameStyle.cpp.test.suffix"; //$NON-NLS-1$
@ -1873,7 +1874,7 @@ public class PreferenceConstants {
* when composing the C++ test file name from the class name. * when composing the C++ test file name from the class name.
* <p> * <p>
* Value is of type <code>String</code>. * Value is of type <code>String</code>.
* *
* @since 5.3 * @since 5.3
*/ */
public static final String NAME_STYLE_CPP_TEST_WORD_DELIMITER = "nameStyle.cpp.test.wordDelimiter"; //$NON-NLS-1$ public static final String NAME_STYLE_CPP_TEST_WORD_DELIMITER = "nameStyle.cpp.test.wordDelimiter"; //$NON-NLS-1$
@ -1882,7 +1883,7 @@ public class PreferenceConstants {
* The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name * The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name
* is to be derived from the class or the variable name without changing * is to be derived from the class or the variable name without changing
* capitalization. * capitalization.
* *
* @since 5.3 * @since 5.3
*/ */
public static final int NAME_STYLE_CAPITALIZATION_ORIGINAL = 0; public static final int NAME_STYLE_CAPITALIZATION_ORIGINAL = 0;
@ -1890,7 +1891,7 @@ public class PreferenceConstants {
* The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name * The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name
* is to be derived from the class or the variable name by converting it to upper * is to be derived from the class or the variable name by converting it to upper
* case. * case.
* *
* @since 5.3 * @since 5.3
*/ */
public static final int NAME_STYLE_CAPITALIZATION_UPPER_CASE = 1; public static final int NAME_STYLE_CAPITALIZATION_UPPER_CASE = 1;
@ -1898,7 +1899,7 @@ public class PreferenceConstants {
* The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name * The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name
* is to be derived from the class or the variable name by converting it to lower * is to be derived from the class or the variable name by converting it to lower
* case. * case.
* *
* @since 5.3 * @since 5.3
*/ */
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CASE = 2; public static final int NAME_STYLE_CAPITALIZATION_LOWER_CASE = 2;
@ -1906,7 +1907,7 @@ public class PreferenceConstants {
* The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name * The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name
* is to be derived from the class or the variable name by capitalizing first * is to be derived from the class or the variable name by capitalizing first
* letter of every word. * letter of every word.
* *
* @since 5.3 * @since 5.3
*/ */
public static final int NAME_STYLE_CAPITALIZATION_CAMEL_CASE = 3; public static final int NAME_STYLE_CAPITALIZATION_CAMEL_CASE = 3;
@ -1914,7 +1915,7 @@ public class PreferenceConstants {
* The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name * The value of <code>NAME_STYLE_*_CAPITALIZATION</code> specifying that the name
* is to be derived from the class or the variable name by capitalizing first * is to be derived from the class or the variable name by capitalizing first
* letter of every word except the first one. * letter of every word except the first one.
* *
* @since 5.3 * @since 5.3
*/ */
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE = 4; public static final int NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE = 4;
@ -1925,7 +1926,7 @@ public class PreferenceConstants {
* <p> * <p>
* Value is of type <code>Boolean</code>. The <code>true</code> value means that private members * Value is of type <code>Boolean</code>. The <code>true</code> value means that private members
* are before public ones. The default is to put public members before private ones. * are before public ones. The default is to put public members before private ones.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = "class_member_ascending_visibility_order"; //$NON-NLS-1$ public static final String CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = "class_member_ascending_visibility_order"; //$NON-NLS-1$
@ -1936,7 +1937,7 @@ public class PreferenceConstants {
* Value is of type <code>Boolean</code>. The <code>true</code> value means that output * Value is of type <code>Boolean</code>. The <code>true</code> value means that output
* parameters are before the input ones. The default is to put outputparameters after the input * parameters are before the input ones. The default is to put outputparameters after the input
* ones. * ones.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT = "function_output_parameters_before_input"; //$NON-NLS-1$ public static final String FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT = "function_output_parameters_before_input"; //$NON-NLS-1$
@ -1947,7 +1948,7 @@ public class PreferenceConstants {
* <p> * <p>
* Value is of type <code>Boolean</code>. The <code>true</code> value means that output * Value is of type <code>Boolean</code>. The <code>true</code> value means that output
* parameters are passed by pointer. The default is to pass output parameters by reference. * parameters are passed by pointer. The default is to pass output parameters by reference.
* *
* @since 5.4 * @since 5.4
*/ */
public static final String FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER = "function_pass_output_parameters_by_pointer"; //$NON-NLS-1$ public static final String FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER = "function_pass_output_parameters_by_pointer"; //$NON-NLS-1$
@ -2057,7 +2058,7 @@ public class PreferenceConstants {
// Formatter profile // Formatter profile
store.setDefault(PreferenceConstants.FORMATTER_PROFILE, FormatterProfileManager.DEFAULT_PROFILE); store.setDefault(PreferenceConstants.FORMATTER_PROFILE, FormatterProfileManager.DEFAULT_PROFILE);
// Content assist // Content assist
store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$
@ -2102,12 +2103,12 @@ public class PreferenceConstants {
// codegen // codegen
store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, false); store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
// mark occurrences // mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true); store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, false); store.setDefault(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, false);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true); store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
// Scalability // Scalability
store.setDefault(PreferenceConstants.SCALABILITY_ALERT, true); store.setDefault(PreferenceConstants.SCALABILITY_ALERT, true);
store.setDefault(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES, 5000); store.setDefault(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES, 5000);
@ -2117,7 +2118,7 @@ public class PreferenceConstants {
store.setDefault(PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT, false); store.setDefault(PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT, false);
store.setDefault(PreferenceConstants.SCALABILITY_PARSER_BASED_CONTENT_ASSIST, false); store.setDefault(PreferenceConstants.SCALABILITY_PARSER_BASED_CONTENT_ASSIST, false);
store.setDefault(PreferenceConstants.SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION, false); store.setDefault(PreferenceConstants.SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION, false);
// Code Templates // Code Templates
store.setDefault(PreferenceConstants.CODE_TEMPLATES_INCLUDE_GUARD_SCHEME, store.setDefault(PreferenceConstants.CODE_TEMPLATES_INCLUDE_GUARD_SCHEME,
CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME); CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME);
@ -2173,14 +2174,13 @@ public class PreferenceConstants {
/** /**
* Returns the node in the preference in the given context. * Returns the node in the preference in the given context.
* @param key The preference key. * @param key The preference key.
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @return Returns the node matching the given context. * @return Returns the node matching the given context.
*/ */
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) { private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
IEclipsePreferences node = null; IEclipsePreferences node = null;
if (project != null) { if (project != null) {
node = new ProjectScope(project.getProject()).getNode(CUIPlugin.PLUGIN_ID); node = new ProjectScope(project.getProject()).getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) { if (node.get(key, null) != null) {
@ -2191,7 +2191,7 @@ public class PreferenceConstants {
if (node.get(key, null) != null) { if (node.get(key, null) != null) {
return node; return node;
} }
node = ConfigurationScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID); node = ConfigurationScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) { if (node.get(key, null) != null) {
return node; return node;
@ -2203,21 +2203,33 @@ public class PreferenceConstants {
/** /**
* Returns the string value for the given key in the given context. * Returns the string value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @return Returns the current value for the string. * @return Returns the current value for the string.
* @since 5.0 * @since 5.0
*/ */
public static String getPreference(String key, ICProject project) { public static String getPreference(String key, ICProject project) {
return getPreferenceNode(key, project).get(key, null); return getPreference(key, project, null);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static String getPreference(String key, ICProject project, String defaultValue) {
return getPreferenceNode(key, project).get(key, defaultValue);
} }
/** /**
* Returns the integer value for the given key in the given context. * Returns the integer value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should
* be avoided. * be avoided.
* @param defaultValue The default value if not specified in the preferences. * @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string. * @return Returns the current value for the string.
@ -2230,9 +2242,8 @@ public class PreferenceConstants {
/** /**
* Returns the boolean value for the given key in the given context. * Returns the boolean value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @param defaultValue The default value if not specified in the preferences. * @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string. * @return Returns the current value for the string.
* @since 5.1 * @since 5.1
@ -2243,14 +2254,12 @@ public class PreferenceConstants {
/** /**
* Returns the scopes for preference lookup. * Returns the scopes for preference lookup.
* *
* @param project a project or <code>null</code> * @param project a project or {@code null}
* @return the scopes for preference lookup. * @return the scopes for preference lookup.
* @since 5.4 * @since 5.4
*/ */
public static IScopeContext[] getPreferenceScopes(IProject project) { public static IScopeContext[] getPreferenceScopes(IProject project) {
return project != null ? return CCorePreferenceConstants.getPreferenceScopes(project);
new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
} }
} }

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.build.crossgcc" id="org.eclipse.cdt.build.crossgcc"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.gnu.build.source" id="org.eclipse.cdt.gnu.build.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.launch.remote" id="org.eclipse.cdt.launch.remote"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.gdb" id="org.eclipse.cdt.gdb"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.gdb.source" id="org.eclipse.cdt.gdb.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.mi.core" id="org.eclipse.cdt.debug.mi.core"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.mi.core.source" id="org.eclipse.cdt.debug.mi.core.source"
download-size="0" download-size="0"

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View file

@ -79,7 +79,7 @@ specifically when using a <em>GDB (DSF)</em> launcher.
<! -------------------------------------------------------------------------------------------------- > <! -------------------------------------------------------------------------------------------------- >
<tr> <tr>
<td rowspan=5 valign="top" headers="category"><strong>General Behavior</strong></td> <td rowspan=7 valign="top" headers="category"><strong>General Behavior</strong></td>
</tr> </tr>
<tr> <tr>
<td valign="top" headers="option"><strong>Terminate GDB when last process exits</strong></td> <td valign="top" headers="option"><strong>Terminate GDB when last process exits</strong></td>
@ -101,6 +101,14 @@ specifically when using a <em>GDB (DSF)</em> launcher.
<td valign="top" headers="description">When checked, the Debug view will only show threads that are suspended. <td valign="top" headers="description">When checked, the Debug view will only show threads that are suspended.
When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously, When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously,
this option is only valuable in <em>non-stop</em> mode, where some threads can run while others are stopped.</td> this option is only valuable in <em>non-stop</em> mode, where some threads can run while others are stopped.</td>
</tr>
<tr>
<td valign="top" headers="option"><strong>Use aggressive breakpoint filtering</strong></td>
<td valign="top" headers="description">When checked, the button "Show Breakpoints Supported by Selected Target"
of the Breakpoints view will only show the breakpoints that affect the currently selected C/C++ debug context
(e.g., thread, process). Otherwise, "Show Breakpoints Supported by Selected Target" will show all breakpoints
that are for any C/C++ target.<p>
<img src="../images/cdt_debug_bp_filter.png" alt="Show Breakpoints Supported by Selected Target button"></td>
</tr> </tr>
<tr> <tr>
<td valign="top" headers="option"><strong>Enable GDB traces</strong></td> <td valign="top" headers="option"><strong>Enable GDB traces</strong></td>
@ -108,7 +116,17 @@ specifically when using a <em>GDB (DSF)</em> launcher.
will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB. will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB.
This information is often critical when the debugger is not behaving as you expect. Include this console output This information is often critical when the debugger is not behaving as you expect. Include this console output
when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at
all times, as it does not cause any negative effect.</td> all times, as it does not cause any negative effect.
<p>
Once the number of characters specified by the <em>limit</em> field is reached, older trace lines will be discarded
gradually. This is to avoid these traces consuming too much memory, for very long debug sessions.</td>
</tr>
<tr>
<td valign="top" headers="option"><strong>Display run-time type of variables</strong></td>
<td valign="top" headers="description">When checked, the CDT debugger will show the actual variable type (not the
declared one) in Variables and Expressions views. Not only does this allow to see what is the current run-time
type of a variable, but it allows to access fields that may not be in the base class.
Note that this feature will only work starting with GDB 7.5.</td>
</tr> </tr>
<! -------------------------------------------------------------------------------------------------- > <! -------------------------------------------------------------------------------------------------- >

View file

@ -11,6 +11,7 @@
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation * IBM Corporation
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@ -645,6 +646,16 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// Need to set layout again. // Need to set layout again.
group2.setLayout(groupLayout); group2.setLayout(groupLayout);
boolField= new BooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter,
group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// Need to set layout again.
group2.setLayout(groupLayout);
final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor( final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES,

View file

@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation * IBM Corporation
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@ -37,6 +38,9 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_useInspectorHover_label; public static String GdbDebugPreferencePage_useInspectorHover_label;
/** @since 2.3 */ /** @since 2.3 */
public static String GdbDebugPreferencePage_hideRunningThreads; public static String GdbDebugPreferencePage_hideRunningThreads;
/** @since 2.4 */
public static String GdbDebugPreferencePage_useAggressiveBpFilter;
/** @since 2.2 */ /** @since 2.2 */
public static String GdbDebugPreferencePage_prettyPrinting_label; public static String GdbDebugPreferencePage_prettyPrinting_label;
/** @since 2.2 */ /** @since 2.2 */

View file

@ -10,6 +10,7 @@
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) # Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) # Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
# IBM Corporation # IBM Corporation
# Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
############################################################################### ###############################################################################
GdbDebugPreferencePage_Add_button=Add GdbDebugPreferencePage_Add_button=Add
@ -25,7 +26,7 @@ GdbDebugPreferencePage_Command_timeout=Command timeout (ms):
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View
GdbDebugPreferencePage_useAggressiveBpFilter=Use aggressive breakpoint filtering
GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing
GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree
GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB) GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB)

View file

@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.jface.util.PropertyChangeEvent;
/**
* BreakpointVMNode for GDB which supports aggressive breakpoint filtering.
* @since 2.4
*/
public class GdbBreakpointVMNode extends RawBreakpointVMNode {
public GdbBreakpointVMNode(BreakpointVMProvider provider) {
super(provider);
}
@Override
public int getDeltaFlags(Object event) {
if (event instanceof PropertyChangeEvent) {
String property = ((PropertyChangeEvent)event).getProperty();
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
return IModelDelta.CONTENT;
}
}
return super.getDeltaFlags(event);
}
@Override
public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
if (event instanceof PropertyChangeEvent) {
String property = ((PropertyChangeEvent)event).getProperty();
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
rm.done();
return;
}
}
super.buildDelta(event, parent, nodeOffset, rm);
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2010 Wind River Systems and others. * Copyright (c) 2008, 2012 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,25 +7,43 @@
* *
* Contributors: * Contributors:
* Wind River Systems - initial API and implementation * Wind River Systems - initial API and implementation
* Mikhail Khodjaiants (Mentor), Marc Khouzam (Ericsson)
* - Optionally use aggressive breakpoint filtering (Bug 360735)
* Marc Khouzam (Ericsson) - Add support to display proper breakpoints when dealing
* with a multi-selection in the debug view (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints; package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateCountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints; import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMData;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension; import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider; import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
@ -38,8 +56,15 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
/** /**
* @since 3.0 * @since 3.0
@ -50,38 +75,109 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
final private DsfServicesTracker fServicesTracker; final private DsfServicesTracker fServicesTracker;
/** Indicator that we should use aggressive breakpoint filtering */
private boolean fUseAggressiveBpFilter = false;
/** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(event.getProperty())) {
fUseAggressiveBpFilter = (Boolean)event.getNewValue();
// Set the property in the presentation context so it can be seen by the vmnode which
// will refresh the view
getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, fUseAggressiveBpFilter);
}
}
};
public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) { public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
super(adapter, presentationContext); super(adapter, presentationContext);
fSession = session; fSession = session;
fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId()); fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
}
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(fPropertyChangeListener);
fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
}
@Override @Override
public void dispose() { public void dispose() {
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
fServicesTracker.dispose(); fServicesTracker.dispose();
super.dispose(); super.dispose();
} }
@Override @Override
protected void calcFileteredBreakpoints(DataRequestMonitor<IBreakpoint[]> rm) { protected void calcFileteredBreakpoints( final DataRequestMonitor<IBreakpoint[]> rm ) {
if (Boolean.TRUE.equals(getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION))) { if ( Boolean.TRUE.equals( getPresentationContext().getProperty( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION ) ) ) {
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); if ( fUseAggressiveBpFilter ) {
List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>(allBreakpoints.length); // Aggressive filtering of breakpoints. Only return bps that are installed on the target.
for (IBreakpoint bp : allBreakpoints) { ISelection debugContext = getDebugContext();
if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(CDebugCorePlugin.PLUGIN_ID)) { if ( debugContext instanceof IStructuredSelection ) {
filteredBPs.add(bp); // Use a set to avoid duplicates
} final Set<IBreakpoint> bps = new HashSet<IBreakpoint>();
}
rm.setData( filteredBPs.toArray(new IBreakpoint[filteredBPs.size()]) ); int count = 0;
rm.done(); final ImmediateCountingRequestMonitor crm = new ImmediateCountingRequestMonitor( rm ) {
} else { @Override
super.calcFileteredBreakpoints(rm); protected void handleSuccess() {
} rm.done( bps.toArray( new IBreakpoint[bps.size()] ) );
}
};
for ( Object element : ( (IStructuredSelection)debugContext ).toList() ) {
IBreakpointsTargetDMContext bpContext = null;
IExecutionDMContext execContext = null;
if ( element instanceof IDMVMContext ) {
bpContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IBreakpointsTargetDMContext.class );
execContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IExecutionDMContext.class );
if ( bpContext != null && fSession.getId().equals( bpContext.getSessionId() ) ) {
count++;
getInstalledBreakpoints( bpContext, execContext, new DataRequestMonitor<Collection<IBreakpoint>>( getExecutor(), crm ) {
@Override
protected void handleCompleted() {
if ( isSuccess() ) {
bps.addAll( getData() );
}
crm.done();
}
} );
}
}
}
crm.setDoneCount(count);
} else {
rm.done( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID,
IDsfStatusConstants.INVALID_HANDLE,
"Invalid debug selection", //$NON-NLS-1$
null ) );
}
} else {
// Original behavior of bp filtering. Return all bp of type ICBreakpoint
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>( allBreakpoints.length );
for (IBreakpoint bp : allBreakpoints) {
if ( bp instanceof ICBreakpoint && bp.getModelIdentifier().equals( CDebugCorePlugin.PLUGIN_ID ) ) {
filteredBPs.add( bp );
}
}
rm.done( filteredBPs.toArray( new IBreakpoint[filteredBPs.size()]) );
}
}
else {
super.calcFileteredBreakpoints( rm );
}
} }
@Override @Override
protected IVMNode createBreakpointVMNode() { protected IVMNode createBreakpointVMNode() {
return new RawBreakpointVMNode(this); return new GdbBreakpointVMNode(this);
} }
@Override @Override
@ -146,4 +242,160 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
rm.done(); rm.done();
} }
} }
private ISelection getDebugContext() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if ( window != null ) {
return DebugUITools.getDebugContextManager().getContextService( window ).getActiveContext();
}
return StructuredSelection.EMPTY;
}
private void getInstalledBreakpoints( final IBreakpointsTargetDMContext targetContext,
final IExecutionDMContext execContext,
final DataRequestMonitor<Collection<IBreakpoint>> rm ) {
try {
fSession.getExecutor().execute( new DsfRunnable() {
@Override
public void run() {
final IBreakpointsExtension bpService = fServicesTracker.getService( IBreakpointsExtension.class );
if ( bpService == null ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
"Breakpoints service not available", //$NON-NLS-1$
null ) );
rm.done();
return;
}
bpService.getBreakpoints( targetContext, new DataRequestMonitor<IBreakpointDMContext[]>( fSession.getExecutor(), rm ) {
@Override
protected void handleSuccess() {
final MIBreakpointsManager bpManager = fServicesTracker.getService( MIBreakpointsManager.class );
if ( bpManager == null ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
"Breakpoint manager service not available", //$NON-NLS-1$
null ) );
rm.done();
return;
}
if ( getData().length > 0 ) {
final Set<IBreakpoint> bps = new HashSet<IBreakpoint>( getData().length );
final CountingRequestMonitor crm = new CountingRequestMonitor( ImmediateExecutor.getInstance(), rm ) {
@Override
protected void handleSuccess() {
rm.setData( bps );
rm.done();
}
};
crm.setDoneCount( getData().length );
for ( final IBreakpointDMContext bpCtx : getData() ) {
bpService.getBreakpointDMData(
bpCtx,
new DataRequestMonitor<IBreakpointDMData>( ImmediateExecutor.getInstance(), crm ) {
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
*/
@Override
protected void handleSuccess() {
if ( getData() instanceof MIBreakpointDMData ) {
MIBreakpointDMData data = (MIBreakpointDMData)getData();
if ( !data.isPending() ) {
bpBelongsToContext( execContext, data, new ImmediateDataRequestMonitor<Boolean>(crm) {
@Override
protected void handleSuccess() {
if (getData()) {
IBreakpoint bp = bpManager.findPlatformBreakpoint( bpCtx );
if ( bp != null )
bps.add( bp );
}
crm.done();
}
});
return;
}
}
crm.done();
}
} );
}
}
else {
rm.setData( new HashSet<IBreakpoint>() );
rm.done();
}
}
} );
}
} );
}
catch( RejectedExecutionException e ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID,
IDsfStatusConstants.INVALID_STATE,
"Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e ) ); //$NON-NLS-1$ //$NON-NLS-2$);
rm.done();
}
}
private void bpBelongsToContext( IExecutionDMContext execContext, final MIBreakpointDMData data, final DataRequestMonitor<Boolean> rm ) {
if ( execContext == null ) {
// No execution context so accept all breakpoints
rm.done( true );
return;
}
// First check if a thread is selected as the context. In that case, we only want to show breakpoints that
// are applicable to that thread.
IMIExecutionDMContext threadContext = DMContexts.getAncestorOfType( execContext, IMIExecutionDMContext.class );
if ( threadContext != null ) {
// A thread is selected. Now make sure this breakpoint is assigned to this thread.
if ( data.getThreadId() != null && data.getThreadId().length() > 0 ) {
try {
int bpThreadId = Integer.parseInt( data.getThreadId() );
// A threadId of 0 means all threads of this process. We therefore will have to check
// if this breakpoint applies to the process that is selected. But if the threadId is not 0
// we simply make sure we have the right thread selected.
if ( bpThreadId != 0 ) {
rm.done( threadContext.getThreadId() == bpThreadId );
return;
}
}
catch( NumberFormatException e ) {
assert false;
GdbUIPlugin.getDefault().getLog().log( new Status(
IStatus.ERROR,
GdbUIPlugin.getUniqueIdentifier(),
"Invalid breakpoint thread id" ) ); //$NON-NLS-1$
rm.done( true );
return;
}
}
}
// If we get here it is that the breakpoint is not assigned to a single thread.
// We therefore make sure the breakpoint is applicable to the selected process.
final IMIContainerDMContext containerContext = DMContexts.getAncestorOfType( execContext, IMIContainerDMContext.class );
if ( containerContext != null ) {
if ( data.getGroupIds() != null ) {
List<String> groupIds = Arrays.asList( data.getGroupIds() );
rm.done( groupIds.contains( containerContext.getGroupId() ) );
} else {
// This happens if we are debugging a single process, so all breakpoints apply.
rm.done( true );
}
} else {
// Accept breakpoint
rm.done( true );
}
}
} }

View file

@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb; package org.eclipse.cdt.dsf.gdb;
@ -131,5 +132,19 @@ public interface IGdbDebugPreferenceConstants {
* @since 4.1 * @since 4.1
*/ */
public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$ public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
/**
* Boolean preference whether to use the new behavior of the command
* "Show Breakpoints Supported by Selected Target" from the Breakpoints view.
* The original behavior is to only show breakpoints that apply to the current debug
* session; so all C/C++ breakpoints but not Java ones.
* The new behavior is to only show breakpoints that are actually installed in the current
* debug session.
*
* Default is <code>true</code>.
*
* @since 4.2
*/
public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
} }

View file

@ -11,6 +11,7 @@
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159) * Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal; package org.eclipse.cdt.dsf.gdb.internal;
@ -43,5 +44,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false); node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT); node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false); node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, true);
} }
} }

View file

@ -8,7 +8,9 @@
* Contributors: * Contributors:
* Ericsson - Initial API and implementation * Ericsson - Initial API and implementation
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320) * Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
* Marc Khouzam (Ericsson) - Fetch groupIds when getting breakpoints (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service; package org.eclipse.cdt.dsf.gdb.service;
import java.util.HashMap; import java.util.HashMap;
@ -27,7 +29,10 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -89,6 +94,73 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
super.shutdown(requestMonitor); super.shutdown(requestMonitor);
} }
/**
* {@inheritDoc}
*
* Starting with GDB 7.2, also provides information about which process each breakpoint applies to.
*/
@Override
public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor<IBreakpointDMContext[]> drm)
{
// Validate the context
if (context == null) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
drm.done();
return;
}
// Select the breakpoints context map
// If it doesn't exist then no breakpoint was ever inserted for this breakpoint space.
// In that case, return an empty list.
final Map<Integer, MIBreakpointDMData> breakpointContext = getBreakpointMap(context);
if (breakpointContext == null) {
drm.setData(new IBreakpointDMContext[0]);
drm.done();
return;
}
// Execute the command
fConnection.queueCommand(fConnection.getCommandFactory().createMIBreakList(context),
new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
@Override
protected void handleSuccess() {
final MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
// Also fetch the information about which breakpoint belongs to which
// process. We currently can only obtain this information from the CLI
// command. This information is needed for breakpoint filtering.
// Bug 360735
fConnection.queueCommand(fConnection.getCommandFactory().createCLIInfoBreak(context),
new ImmediateDataRequestMonitor<CLIInfoBreakInfo>(drm) {
@Override
protected void handleSuccess() {
Map<Integer, String[]> groupIdMap = getData().getBreakpointToGroupMap();
// Refresh the breakpoints map and format the result
breakpointContext.clear();
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
for (int i = 0; i < breakpoints.length; i++) {
MIBreakpointDMData breakpointData = new MIBreakpointDMData(breakpoints[i]);
// Now fill in the thread-group information into the breakpoint data
// It is ok to get null. For example, pending breakpoints are not
// associated to a thread-group; also, when debugging a single process,
// the thread-group list is empty.
int reference = breakpointData.getReference();
String[] groupIds = groupIdMap.get(reference);
breakpointData.setGroupIds(groupIds);
result[i] = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
breakpointContext.put(reference, breakpointData);
}
drm.setData(result);
drm.done();
}
});
}
});
}
private void setTracepointMode() { private void setTracepointMode() {
ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class); ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT; String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;

View file

@ -269,6 +269,10 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.isEnabled(); return fBreakpoint.isEnabled();
} }
///////////////////////////////////////////////////////////////////////////
// MIBreakpointDMData
///////////////////////////////////////////////////////////////////////////
/** /**
* @since 3.0 * @since 3.0
*/ */
@ -283,10 +287,6 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getCommands(); return fBreakpoint.getCommands();
} }
///////////////////////////////////////////////////////////////////////////
// MIBreakpointDMData
///////////////////////////////////////////////////////////////////////////
public int getNumber() { public int getNumber() {
return fBreakpoint.getNumber(); return fBreakpoint.getNumber();
} }
@ -295,6 +295,16 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getThreadId(); return fBreakpoint.getThreadId();
} }
/** @since 4.2 */
public String[] getGroupIds() {
return fBreakpoint.getGroupIds();
}
/** @since 4.2 */
public void setGroupIds(String[] groups) {
fBreakpoint.setGroupIds(groups);
}
public boolean isTemporary() { public boolean isTemporary() {
return fBreakpoint.isTemporary(); return fBreakpoint.isTemporary();
} }

View file

@ -1408,7 +1408,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/ */
public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) { public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) {
if (bpContext instanceof MIBreakpointDMContext) { if (bpContext instanceof MIBreakpointDMContext) {
return findPlatformBreakpoint(((MIBreakpointDMContext)bpContext).getReference()); IBreakpointsTargetDMContext targetCtx = DMContexts.getAncestorOfType(bpContext, IBreakpointsTargetDMContext.class);
if (targetCtx != null) {
Map<IBreakpointDMContext, ICBreakpoint> bps = fTargetBPs.get(targetCtx);
if (bps != null)
return bps.get(bpContext);
}
} }
return null; return null;
} }

View file

@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch; import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoBreak;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoProgram; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoProgram;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads;
@ -167,6 +168,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowAttributes;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat; import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate; import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate;
import org.eclipse.cdt.dsf.mi.service.command.output.CLICatchInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLICatchInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoProgramInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoProgramInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo;
@ -241,6 +243,16 @@ public class CommandFactory {
return new CLIExecAbort(ctx); return new CLIExecAbort(ctx);
} }
/** @since 4.2 */
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx) {
return new CLIInfoBreak(ctx);
}
/** @since 4.2 */
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx, int bpRef) {
return new CLIInfoBreak(ctx, bpRef);
}
public ICommand<CLIInfoProgramInfo> createCLIInfoProgram(IContainerDMContext ctx) { public ICommand<CLIInfoProgramInfo> createCLIInfoProgram(IContainerDMContext ctx) {
return new CLIInfoProgram(ctx); return new CLIInfoProgram(ctx);
} }

View file

@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* 'info break [BP_REFERENCE]
*
* will return information about the specified breakpoint. If no breakpoint is
* specified, it will return information about all breakpoints.
* We use it to find out to which inferior a breakpoint is applicable.
* This information is not available from -break-list or -break-info until GDB 7.6.
*
* @since 4.2
*/
public class CLIInfoBreak extends CLICommand<CLIInfoBreakInfo> {
private static final String INFO_BREAK = "info break"; //$NON-NLS-1$
public CLIInfoBreak(IDMContext ctx) {
super(ctx, INFO_BREAK);
};
public CLIInfoBreak(IDMContext ctx, int bpReference) {
super(ctx, INFO_BREAK + Integer.toString(bpReference));
}
@Override
public CLIInfoBreakInfo getResult(MIOutput MIresult) {
return new CLIInfoBreakInfo(MIresult);
}
}

View file

@ -0,0 +1,113 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* 'info break [BP_REFERENCE] will return information about
* the specified breakpoint. We use it to find out to which
* inferiors a breakpoint is applicable.
*
* sample output:
*
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 1
* 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 1
*
* If only one inferior is being debugged there is not mention of the inferior:
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y 0x08048533 in main() at loopfirst.cc:8
* 2 breakpoint keep y 0x08048553 in main() at loopfirst.cc:9
*
* Note that the below output is theoretically possible looking at GDB's code but
* I haven't figured out a way to trigger it. Still, we should be prepared for it:
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 3, 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 2, 1
* 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2, 1
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 3, 2, 1
*
* @since 4.2
*/
public class CLIInfoBreakInfo extends MIInfo {
private Map<Integer, String[]> fBreakpointToGroupMap = new HashMap<Integer, String[]>();
public CLIInfoBreakInfo(MIOutput out) {
super(out);
parse();
}
/**
* Returns the map of breakpoint to groupId array indicating to which thread-group
* each breakpoint applies. If there is only a single thread-group being debugged, an
* empty map will be returned.
*/
public Map<Integer, String[]> getBreakpointToGroupMap() {
return fBreakpointToGroupMap;
}
protected void parse() {
final String INFERIOR_PREFIX = " inf "; //$NON-NLS-1$
if (isDone()) {
MIOutput out = getMIOutput();
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
String line = ((MIConsoleStreamOutput)oob).getString().trim();
int loc = line.indexOf(INFERIOR_PREFIX);
if (loc >= 0) {
// Get the breakpoint id by extracting the first element before a white space
// or before a period. We can set a limit of 2 since we only need the first element
String bpIdStr = line.split("[\\s\\.]", 2)[0]; //$NON-NLS-1$
int bpId = 0;
try {
bpId = Integer.parseInt(bpIdStr);
} catch (NumberFormatException e) {
assert false;
}
String[] groups = fBreakpointToGroupMap.get(bpId);
Set<String> groupIdList = new HashSet<String>();
if (groups != null) {
// Since we already know about this breakpoint id we must retain the list
// we have been building
groupIdList.addAll(Arrays.asList(groups));
}
// Get the comma-separated list of inferiors
// Split the list into individual ids
String inferiorIdStr = line.substring(loc + INFERIOR_PREFIX.length()).trim();
for (String id : inferiorIdStr.split(",")) { //$NON-NLS-1$
// Add the 'i' prefix as GDB does for MI commands
groupIdList.add("i" + id.trim()); //$NON-NLS-1$
}
fBreakpointToGroupMap.put(bpId, groupIdList.toArray(new String[groupIdList.size()]));
}
}
}
}
}
}

View file

@ -11,10 +11,14 @@
* Ericsson - Modified for the breakpoint service * Ericsson - Modified for the breakpoint service
* Ericsson - Added Tracepoint support (284286) * Ericsson - Added Tracepoint support (284286)
* Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint * Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint
* Marc Khouzam (Ericsson) - Add 'thread-group' field (bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output; package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager; import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager;
@ -105,6 +109,13 @@ public class MIBreakpoint {
*/ */
private boolean pending; private boolean pending;
/**
* The list of groupIds to which this breakpoint applies.
* This field is only reported by MI starting with GDB 7.6.
* null will be returned if this field is not present.
*/
private String[] groupIds;
public MIBreakpoint() { public MIBreakpoint() {
} }
@ -134,6 +145,9 @@ public class MIBreakpoint {
isCatchpoint = other.isCatchpoint; isCatchpoint = other.isCatchpoint;
catchpointType = other.catchpointType; catchpointType = other.catchpointType;
pending = other.pending; pending = other.pending;
if (other.groupIds != null) {
groupIds = Arrays.copyOf(other.groupIds, other.groupIds.length);
}
} }
public MIBreakpoint(MITuple tuple) { public MIBreakpoint(MITuple tuple) {
@ -409,6 +423,25 @@ public class MIBreakpoint {
return pending; return pending;
} }
/**
* Returns the thread-groups to which this breakpoint applies.
* Returns null if the data is not known.
*
* @since 4.2
*/
public String[] getGroupIds() {
return groupIds;
}
/**
* Sets the list of thread-groups to which this breakpoint applies.
*
* @since 4.2
*/
public void setGroupIds(String[] groups) {
groupIds = groups;
}
// Parse the result string // Parse the result string
void parse(MITuple tuple) { void parse(MITuple tuple) {
MIResult[] results = tuple.getMIResults(); MIResult[] results = tuple.getMIResults();
@ -504,6 +537,10 @@ public class MIBreakpoint {
if (value instanceof MITuple) { if (value instanceof MITuple) {
parseCommands((MITuple)value); parseCommands((MITuple)value);
} }
} else if (var.equals("thread-group")) { //$NON-NLS-1$
if (value instanceof MIList) {
parseGroups((MIList)value);
}
} }
} }
} }
@ -524,4 +561,17 @@ public class MIBreakpoint {
setCommands(cmds.toString()); setCommands(cmds.toString());
} }
private void parseGroups(MIList list) {
List<String> groups = new ArrayList<String>();
MIValue[] values = list.getMIValues();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof MIConst) {
groups.add(((MIConst)values[i]).getCString());
}
}
groupIds = groups.toArray(new String[groups.size()]);
}
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Ericsson - Adapted for DSF * Ericsson - Adapted for DSF
* Dmitry Kozlov (Mentor) - Add tab symbols parsing (Bug 391115)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output; package org.eclipse.cdt.dsf.mi.service.command.output;
@ -111,6 +112,8 @@ public class MIInstruction extends AbstractInstruction {
translated string since the only thing we are doing is translated string since the only thing we are doing is
displaying it. */ displaying it. */
str = ((MIConst) value).getString(); str = ((MIConst) value).getString();
/* to avoid improper displaying of instructions we need to translate tabs */
str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
char chars[] = str.toCharArray(); char chars[] = str.toCharArray();
int index = 0; int index = 0;

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.dsf.gdb" id="org.eclipse.cdt.dsf.gdb"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.dsf.gdb.source" id="org.eclipse.cdt.dsf.gdb.source"
download-size="0" download-size="0"

View file

@ -391,8 +391,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
if ( i < newLength ) { if ( i < newLength ) {
newBlock[i].setFlags(fBlock[distance + i].getFlags()); newBlock[i].setFlags(fBlock[distance + i].getFlags());
newBlock[i].setHistoryKnown(true);
if (newBlock[i].getValue() != fBlock[distance + i].getValue()) { if (newBlock[i].getValue() != fBlock[distance + i].getValue()) {
newBlock[i].setHistoryKnown(true);
newBlock[i].setChanged(true); newBlock[i].setChanged(true);
} }
} }
@ -477,8 +477,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
if ( (distance + i) < newLength ) { if ( (distance + i) < newLength ) {
newBlock[distance + i].setFlags(fBlock[i].getFlags()); newBlock[distance + i].setFlags(fBlock[i].getFlags());
newBlock[distance + i].setHistoryKnown(true);
if (newBlock[distance + i].getValue() != fBlock[i].getValue()) { if (newBlock[distance + i].getValue() != fBlock[i].getValue()) {
newBlock[distance + i].setHistoryKnown(true);
newBlock[distance + i].setChanged(true); newBlock[distance + i].setChanged(true);
} }
} }

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.examples.dsf" id="org.eclipse.cdt.examples.dsf"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.gnu.build.source" id="org.eclipse.cdt.gnu.build.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.gdbjtag.core" id="org.eclipse.cdt.debug.gdbjtag.core"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="net.sourceforge.lpg.lpgjavaruntime" id="net.sourceforge.lpg.lpgjavaruntime"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.lrparser.source" id="org.eclipse.cdt.core.lrparser.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.lrparser.source" id="org.eclipse.cdt.core.lrparser.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.memory.search" id="org.eclipse.cdt.debug.ui.memory.search"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.memory.search.source" id="org.eclipse.cdt.debug.ui.memory.search.source"
download-size="0" download-size="0"

View file

@ -485,9 +485,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
protected BigInteger getCaretAddress() protected BigInteger getCaretAddress()
{ {
// Return the caret address if it has been set, otherwise return the // Return the caret address if it has been set, otherwise return the
// viewport address. When the rendering is first created, the caret is // viewport address. When the rendering is first created, the caret is
// unset until the user clicks somewhere in the rendering. It also reset // unset until the user clicks somewhere in the rendering. It also reset
// (unset) when the user gives us a new viewport address // (unset) when the user gives us a new viewport address
return (fCaretAddress != null) ? fCaretAddress : fViewportAddress; return (fCaretAddress != null) ? fCaretAddress : fViewportAddress;
} }
@ -583,11 +583,15 @@ public class Rendering extends Composite implements IDebugEventSetListener
{ {
final int kind = events[i].getKind(); final int kind = events[i].getKind();
final int detail = events[i].getDetail(); final int detail = events[i].getDetail();
final IDebugElement source = (IDebugElement) events[i] final IDebugElement source = (IDebugElement) events[i].getSource();
.getSource(); /*
* We have to make sure we are comparing memory blocks here. It pretty much is now the
if(source.getDebugTarget() == getMemoryBlock() * case that the IDebugTarget is always null. Almost no one in the Embedded Space is
.getDebugTarget()) * using anything but CDT/DSF or CDT/TCF at this point. The older CDI stuff will still
* be using the old Debug Model API. But this will generate the same memory block and
* a legitimate IDebugTarget which will match properly.
*/
if(source.equals( getMemoryBlock() ) && source.getDebugTarget() == getMemoryBlock().getDebugTarget() )
{ {
if((detail & DebugEvent.BREAKPOINT) != 0) if((detail & DebugEvent.BREAKPOINT) != 0)
isBreakpointHit = true; isBreakpointHit = true;
@ -620,7 +624,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
{ {
public void run() public void run()
{ {
archiveDeltas(); archiveDeltas();
refresh(); refresh();
} }
}); });

View file

@ -23,17 +23,24 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.MemoryByte; import org.eclipse.debug.core.model.MemoryByte;
import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection; import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection;
import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRendering; import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
import org.eclipse.debug.ui.memory.AbstractTableRendering; import org.eclipse.debug.ui.memory.AbstractTableRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering; import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering; import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering; import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
@ -86,7 +93,7 @@ import org.eclipse.ui.progress.UIJob;
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider, IModelChangedListener
{ {
protected Rendering fRendering; protected Rendering fRendering;
protected Action displayEndianBigAction; protected Action displayEndianBigAction;
@ -96,7 +103,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
private IMemoryBlockConnection fConnection; private IMemoryBlockConnection fConnection;
private final static int MAX_MENU_COLUMN_COUNT = 8; private final static int MAX_MENU_COLUMN_COUNT = 8;
public TraditionalRendering(String id) public TraditionalRendering(String id)
{ {
super(id); super(id);
@ -188,10 +195,84 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
private int fAddressableSize; private int fAddressableSize;
private int fAddressSize; private int fAddressSize;
/*
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener#modelChanged(org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta, org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy)
*/
public void modelChanged(IModelDelta delta, IModelProxy proxy)
{
/*
* The event model in the traditional renderer is written to expect a suspend first
* which will cause it to save its current data set away in an archive. Then when
* the state change comes through it will compare and refresh showing a difference.
*/
int flags = delta.getFlags();
if ( ( flags & IModelDelta.STATE ) != 0 ) {
fRendering.handleSuspend(false);
}
fRendering.handleChange();
}
/*
* We use the model proxy which is supplied by the TCF implementation to provide the knowledge of memory
* change notifications. The older backends ( the reference model, Wind River Systems Inc. ) are written
* to generate the Debug Model events. TCF follows the "ModelDelta/IModelProxy" implementation that the
* platform renderers use. So this implementation acts as a shim. If the older Debug Events come in then
* fine. If the newer model deltas come in fine also.
*/
private IModelProxy fModel;
@Override @Override
public void init(IMemoryRenderingContainer container, IMemoryBlock block) public void dispose()
{
/*
* We use the UI dispatch thread to protect the proxy information. Even though I believe the
* dispose routine is always called in the UI dispatch thread. I am going to make sure.
*/
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if ( fModel != null ) {
fModel.removeModelChangedListener(TraditionalRendering.this);
fModel.dispose();
}
}});
if(this.fRendering != null)
this.fRendering.dispose();
disposeColors();
super.dispose();
}
@Override
public void init(final IMemoryRenderingContainer container, final IMemoryBlock block)
{ {
super.init(container, block); super.init(container, block);
/*
* Working with the model proxy must be done on the UI dispatch thread.
*/
final IModelProxyFactory factory = (IModelProxyFactory) DebugPlugin.getAdapter(block, IModelProxyFactory.class );
if ( factory != null ) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
/*
* The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
* to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
*/
IMemoryRenderingSite site = container.getMemoryRenderingSite();
MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, TraditionalRendering.this);
/*
* Get a new proxy and perform the initialization sequence so we are known the
* the model provider.
*/
fModel = factory.createModelProxy(block, context);
fModel.installed(null);
fModel.addModelChangedListener(TraditionalRendering.this);
}});
}
try try
{ {
@ -1235,15 +1316,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
// user can then change display endian if desired. // user can then change display endian if desired.
fRendering.setDisplayLittleEndian(littleEndian); fRendering.setDisplayLittleEndian(littleEndian);
} }
@Override
public void dispose()
{
if(this.fRendering != null)
this.fRendering.dispose();
disposeColors();
super.dispose();
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
@ -1251,7 +1323,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) public Object getAdapter(Class adapter)
{ {
if(adapter == IWorkbenchAdapter.class) if(adapter == IWorkbenchAdapter.class)
{ {
if(this.fWorkbenchAdapter == null) if(this.fWorkbenchAdapter == null)
@ -1317,7 +1389,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
return super.getAdapter(adapter); return super.getAdapter(adapter);
} }
public void resetRendering() throws DebugException { public void resetRendering() throws DebugException {
fRendering.gotoAddress(fRendering.fBaseAddress); fRendering.gotoAddress(fRendering.fBaseAddress);
} }
@ -1335,8 +1407,8 @@ class CopyBinaryAction extends CopyAction
public CopyBinaryAction(Rendering rendering) { public CopyBinaryAction(Rendering rendering) {
super(rendering, CopyType.BINARY, DND.CLIPBOARD); super(rendering, CopyType.BINARY, DND.CLIPBOARD);
setText(TraditionalRenderingMessages.getString("TraditionalRendering.BINARY")); //$NON-NLS-1$ setText(TraditionalRenderingMessages.getString("TraditionalRendering.BINARY")); //$NON-NLS-1$
setToolTipText(TraditionalRenderingMessages.getString("TraditionalRendering.COPY_SELECTED_DATA")); //$NON-NLS-1$ setToolTipText(TraditionalRenderingMessages.getString("TraditionalRendering.COPY_SELECTED_DATA")); //$NON-NLS-1$
} }
} }

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.platform" id="org.eclipse.cdt.platform"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt" id="org.eclipse.cdt"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.source" id="org.eclipse.cdt.core.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.platform.source" id="org.eclipse.cdt.platform.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.tests" id="org.eclipse.cdt.debug.ui.tests"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.testsrunner" id="org.eclipse.cdt.testsrunner"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.testsrunner.source" id="org.eclipse.cdt.testsrunner.source"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.bupc.ui" id="org.eclipse.cdt.managedbuilder.bupc.ui"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.lrparser.feature" id="org.eclipse.cdt.core.lrparser.feature"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.parser.upc.source" id="org.eclipse.cdt.core.parser.upc.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.parser.upc.source" id="org.eclipse.cdt.core.parser.upc.source"
download-size="0" download-size="0"

View file

@ -19,10 +19,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.util" id="org.eclipse.cdt.util"
download-size="0" download-size="0"

View file

@ -81,22 +81,31 @@ public class WinEnvironmentVariableSupplier
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]); return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
} }
private static String getSoftwareKey(WindowsRegistry reg, String subkey, String name) {
String value = reg.getLocalMachineValue("SOFTWARE\\" + subkey, name);
// Visual Studio is a 32 bit application so on Windows 64 the keys will be in Wow6432Node
if (value == null) {
value = reg.getLocalMachineValue("SOFTWARE\\Wow6432Node\\" + subkey, name);
}
return value;
}
// Current support is for Windows SDK 7.1 with Visual C++ 10.0 // Current support is for Windows SDK 7.1 with Visual C++ 10.0
// Secondary support for Windows SDK 7.0 with Visual C++ 9.0 // Secondary support for Windows SDK 7.0 with Visual C++ 9.0
private static String getSDKDir() { private static String getSDKDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry(); WindowsRegistry reg = WindowsRegistry.getRegistry();
String sdkDir = reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder"); String sdkDir = getSoftwareKey(reg, "Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder");
if (sdkDir != null) if (sdkDir != null)
return sdkDir; return sdkDir;
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder"); return getSoftwareKey(reg, "Microsoft SDKs\\Windows\\v7.0", "InstallationFolder");
} }
private static String getVCDir() { private static String getVCDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry(); WindowsRegistry reg = WindowsRegistry.getRegistry();
String vcDir = reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "10.0"); String vcDir = getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "10.0");
if (vcDir != null) if (vcDir != null)
return vcDir; return vcDir;
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "9.0"); return getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "9.0");
} }
public static IPath[] getIncludePath() { public static IPath[] getIncludePath() {

View file

@ -19,10 +19,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.errorparsers.xlc" id="org.eclipse.cdt.errorparsers.xlc"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.xlc.source" id="org.eclipse.cdt.xlc.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.errorparsers.xlc.source" id="org.eclipse.cdt.errorparsers.xlc.source"
download-size="0" download-size="0"