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-08-31 20:31:51 -04:00
commit ef270e1bbe
86 changed files with 1229 additions and 299 deletions

View file

@ -1,3 +1,9 @@
2012-08-29 Jeff Johnston <jjohnstn@redhat.com>
Resolves: bug #388354
* plugin.properties: Fix statedir option help tip message.
* src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties: Ditto.
2012-07-23 Jeff Johnston <jjohnstn@redhat.com>
* src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java: New file.

View file

@ -114,7 +114,7 @@ Option.configure.srcdir.tip=Place where configure can find sources [configure di
Option.configure.localstatedir=Modifiable single-machine data directory (--localstatedir)
Option.configure.localstatedir.tip=Place where modifiable single-machine data is installed [PREFIX/var]
Option.configure.sharedstatedir=Modifiable architecture-independent data directory (--sharedstatedir)
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com}
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com]
Option.configure.libexecdir=Program executable directory (--libexecdir)
Option.configure.libexecdir=Place where program executables will be installed [EPREFIX/libexec]
Option.configure.oldincludedir=Non-gcc C header file directory (--oldincludedir)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2012 Red Hat Inc.
* Copyright (c) 2009, 2011 Red Hat Inc.
* 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
@ -7,7 +7,6 @@
*
* Contributors:
* Red Hat Inc. - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.core.configure;
@ -17,10 +16,9 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
public class AutotoolsConfiguration implements IAConfiguration {
public static class Option {
@ -59,11 +57,11 @@ public class AutotoolsConfiguration implements IAConfiguration {
}
public String getDescription() {
return TextProcessor.process(ConfigureMessages.getConfigureDescription(transformedName));
return ConfigureMessages.getConfigureDescription(transformedName);
}
public String getToolTip() {
return TextProcessor.process(ConfigureMessages.getConfigureTip(transformedName));
return ConfigureMessages.getConfigureTip(transformedName);
}
}

View file

@ -59,7 +59,7 @@ Option.configure.srcdir.tip=Place where configure can find sources [configure di
Option.configure.localstatedir=Single-machine data directory (--localstatedir)
Option.configure.localstatedir.tip=Place where modifiable single-machine data is installed [PREFIX/var]
Option.configure.sharedstatedir=Arch-independent data directory (--sharedstatedir)
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com}
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com]
Option.configure.libexecdir=Program executable directory (--libexecdir)
Option.configure.libexecdir.tip=Place where program executables will be installed [EPREFIX/libexec]
Option.configure.oldincludedir=Non-gcc C header file directory (--oldincludedir)

View file

@ -38,7 +38,7 @@
<ol>
<li>Invoke Autoconf
<ul>
<li>The autoconf tool is run in the current directory for the current file or folder selected for the project. There are no parameters. Autoconf can also be run by right-clicking a configure.in or configure.ac file and selected Invoke Autoconf.
<li>The autoconf tool is run in the current directory for the current file or folder selected for the project. There are no parameters. Autoconf can also be run by right-clicking a configure.in or configure.ac file and selecting Invoke Autoconf.
<br/>
</li>
</ul>

View file

@ -55,7 +55,7 @@
<description>
In the Console view, there is a button entitled &quot;Display Selected Console&quot;. Its icon depicts a monitor with two lines of text on it. Pressing this button will drop down to show all available consoles. At this point, you should have three consoles: one for configure output (&quot;Configure&quot;), one for build output (&quot;C-Build&quot;), and one for the binary output that you just ran (&quot;&lt;terminated&gt; sources ...&quot;).
</description>
<subitem label="View configure output by selecting the Configure console in the drop-down list. The configure console" skip="false">
<subitem label="View configure output by selecting the Configure console in the drop-down list." skip="false">
</subitem>
<subitem label="View build output by selecting the &quot;C-Build&quot; console in the drop-down list." skip="false">
</subitem>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="GNU Tools">
<topic label="gcc" href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/"/>
<toc label="GNU Tools On-line Documentation">
<topic label="gcc" href="http://gcc.gnu.org/onlinedocs/"/>
<topic label="binutils" href="http://sourceware.org/binutils/docs/"/>
<topic label="autoconf" href="http://www.gnu.org/software/autoconf/manual/html_node/index.html"/>
<topic label="automake" href="http://www.gnu.org/software/automake/manual/html_node/index.html"/>

View file

@ -1,3 +1,8 @@
2012-08-29 Jeff Johnston <jjohnstn@redhat.com>
Resolves: bug #388354
* plugin.properties: Fix statedir option help tip message.
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java

View file

@ -113,7 +113,7 @@ Option.configure.srcdir.tip=Place where configure can find sources [configure di
Option.configure.localstatedir=Modifiable single-machine data directory (--localstatedir)
Option.configure.localstatedir.tip=Place where modifiable single-machine data is installed [PREFIX/var]
Option.configure.sharedstatedir=Modifiable architecture-independent data directory (--sharedstatedir)
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com}
Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com]
Option.configure.libexecdir=Program executable directory (--libexecdir)
Option.configure.libexecdir=Place where program executables will be installed [EPREFIX/libexec]
Option.configure.oldincludedir=Non-gcc C header file directory (--oldincludedir)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2012 Red Hat Inc..
* Copyright (c) 2006, 2007, 2009 Red Hat Inc..
* 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
@ -7,7 +7,6 @@
*
* Contributors:
* Red Hat Incorporated - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.actions;
@ -15,8 +14,6 @@ import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.osgi.util.TextProcessor;
public class InvokeMessages {
private static final String BUNDLE_NAME = InvokeMessages.class.getName();
@ -35,7 +32,7 @@ public class InvokeMessages {
*/
public static String getString(String key) {
try {
return TextProcessor.process(RESOURCE_BUNDLE.getString(key));
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
@ -50,7 +47,7 @@ public class InvokeMessages {
* @return the resource bundle message
*/
public static String getFormattedString(String key, String[] args) {
return TextProcessor.process(MessageFormat.format(getString(key), (Object[])args));
return MessageFormat.format(getString(key), (Object[])args);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2012 Intel Corporation and others.
* Copyright (c) 2007, 2011 Intel Corporation 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
@ -8,7 +8,6 @@
* Contributors:
* Intel Corporation - initial API and implementation
* James Blackbrun (Broadcom Corp.)
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
@ -32,7 +31,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -142,7 +140,7 @@ public class CDTConfigWizardPage extends WizardPage {
tv.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return element == null ? EMPTY_STR : TextProcessor.process(((CfgHolder)element).getName());
return element == null ? EMPTY_STR : ((CfgHolder)element).getName();
}
@Override
public Image getImage(Object element) { return IMG_CONFIG; }

View file

@ -54,9 +54,6 @@ public abstract class GenericErrorParserTests extends TestCase {
super();
}
/*
* @see TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
@ -66,9 +63,6 @@ public abstract class GenericErrorParserTests extends TestCase {
}
}
/*
* @see TestCase#tearDown()
*/
@Override
protected void tearDown() {
try {
@ -112,9 +106,9 @@ public abstract class GenericErrorParserTests extends TestCase {
runParserTest(inputStream, expectedErrorCount, expectedWarningCount, 0, expectedFileNames, expectedDescriptions, parserID);
}
protected void runParserTest(InputStream inputStream, int expectedErrorCount, int expectedWarningCount, int expectedInfoCount,
String[] expectedFileNames, String[] expectedDescriptions, String[] parserID) throws IOException {
protected void runParserTest(InputStream inputStream, int expectedErrorCount, int expectedWarningCount,
int expectedInfoCount, String[] expectedFileNames, String[] expectedDescriptions,
String[] parserID) throws IOException {
assertNotNull(inputStream);
CountingMarkerGenerator markerGenerator = new CountingMarkerGenerator();
@ -166,41 +160,28 @@ public abstract class GenericErrorParserTests extends TestCase {
ByteArrayInputStream inputStream = new ByteArrayInputStream(errorStream.getBytes());
runParserTest(inputStream, expectedErrorCount, expectedWarningCount, expectedInfoCount, expectedFileNames, expectedDescriptions, parserID);
runParserTest(inputStream, expectedErrorCount, expectedWarningCount, expectedInfoCount,
expectedFileNames, expectedDescriptions, parserID);
}
class FileNameComparator implements Comparator {
/*
* (non-Javadoc)
*
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
private static class FileNameComparator implements Comparator<IResource> {
@Override
public int compare(Object arg0, Object arg1) {
try {
IFile f0 = (IFile)arg0;
IFile f1 = (IFile)arg1;
return f0.getName().compareToIgnoreCase(f1.getName());
} catch (Exception ex) {
/* Ignore */
}
return 1;
public int compare(IResource f0, IResource f1) {
return f0.getName().compareToIgnoreCase(f1.getName());
}
}
/**
* Expand and grow this class to make it more usefull.
* Expand and grow this class to make it more useful.
*/
class CountingMarkerGenerator implements IMarkerGenerator {
public int numErrors;
public int numWarnings;
public int numInfos;
public int numMarkers;
public ArrayList uniqFiles;
public ArrayList<IResource> uniqFiles;
public List<String> descriptions;
private Comparator fFileNameComparator;
private FileNameComparator fFileNameComparator;
@Override
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
@ -208,10 +189,6 @@ public abstract class GenericErrorParserTests extends TestCase {
addMarker(problemMarkerInfo);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
*/
@Override
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
int index = Collections.binarySearch(uniqFiles, problemMarkerInfo.file, fFileNameComparator);
@ -231,7 +208,6 @@ public abstract class GenericErrorParserTests extends TestCase {
numMarkers++;
}
public CountingMarkerGenerator() {
numErrors = 0;
numWarnings = 0;
@ -247,7 +223,6 @@ public abstract class GenericErrorParserTests extends TestCase {
* exist by just using the strings that come out as error codes.
*/
class ImaginaryFilesErrorParserManager extends ErrorParserManager {
IProject fProject;
public ImaginaryFilesErrorParserManager(IProject project, IMarkerGenerator generator, String[] ids) {
@ -284,7 +259,7 @@ public abstract class GenericErrorParserTests extends TestCase {
InputStream stream = new ByteArrayInputStream("TestFile".getBytes());
file.create(stream, true, new NullProgressMonitor());
stream.close();
} catch (Exception ex) {
} catch (Exception e) {
/* Ignore */
}
}

View file

@ -56,6 +56,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
@ -128,6 +129,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
@ -9768,4 +9771,161 @@ public class AST2CPPTests extends AST2BaseTest {
public void testFriendTemplateParameter() throws Exception {
parseAndCheckBindings();
}
// struct S {
// virtual void mFuncDecl() final;
// virtual void mFuncDef() final {}
// };
public void testFinalFunction() throws Exception {
String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true);
CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl()", 9);
assertFalse(functionDeclarationBinding.isOverride());
assertTrue(functionDeclarationBinding.isFinal());
IASTNode[] functionDeclarators = functionDeclarationBinding.getDeclarations();
assertEquals(1, functionDeclarators.length);
assertInstance(functionDeclarators[0], ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)functionDeclarators[0], false, true);
CPPMethod functionDefinitionBinding = bindingHelper.assertNonProblem("mFuncDef()", 8);
assertFalse(functionDefinitionBinding.isOverride());
assertTrue(functionDefinitionBinding.isFinal());
IASTFunctionDeclarator declarator = functionDefinitionBinding.getDefinition();
assertInstance(declarator, ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)declarator, false, true);
}
// struct Base {
// virtual void mFuncDecl();
// virtual void mFuncDef(){}
// };
// struct S : public Base {
// void mFuncDecl() override;
// void mFuncDef() override {}
// };
public void testOverrideFunction() throws Exception {
String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true);
CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl() override", 9);
assertTrue(functionDeclarationBinding.isOverride());
assertFalse(functionDeclarationBinding.isFinal());
IASTDeclarator[] functionDeclarators = functionDeclarationBinding.getDeclarations();
assertEquals(1, functionDeclarators.length);
assertInstance(functionDeclarators[0], ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)functionDeclarators[0], true, false);
CPPMethod functionDefinitionBinding = bindingHelper.assertNonProblem("mFuncDef() override", 8);
assertTrue(functionDefinitionBinding.isOverride());
assertFalse(functionDefinitionBinding.isFinal());
IASTFunctionDeclarator declarator = functionDefinitionBinding.getDefinition();
assertInstance(declarator, ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)declarator, true, false);
}
// struct Base {
// virtual void mFuncDecl();
// virtual void mFuncDef(){}
// };
// struct S : public Base {
// void mFuncDecl() final override;
// void mFuncDef() final override {}
// };
public void testOverrideFinalFunction() throws Exception {
String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true);
CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl() final", 9);
assertTrue(functionDeclarationBinding.isOverride());
assertTrue(functionDeclarationBinding.isFinal());
IASTDeclarator[] functionDeclarators = functionDeclarationBinding.getDeclarations();
assertEquals(1, functionDeclarators.length);
assertInstance(functionDeclarators[0], ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)functionDeclarators[0], true, true);
CPPMethod functionDefinitionBinding = bindingHelper.assertNonProblem("mFuncDef() final", 8);
assertTrue(functionDefinitionBinding.isOverride());
assertTrue(functionDefinitionBinding.isFinal());
IASTFunctionDeclarator declarator = functionDefinitionBinding.getDefinition();
assertInstance(declarator, ICPPASTFunctionDeclarator.class);
assertVirtualSpecifiers((ICPPASTFunctionDeclarator)declarator, true, true);
}
private void assertVirtualSpecifiers(ICPPASTFunctionDeclarator declarator, boolean expectOverride, boolean expectFinal) {
assertEquals(expectOverride, declarator.isOverride());
assertEquals(expectFinal, declarator.isFinal());
}
// struct Base {
// };
// struct S final : public Base {
// };
public void testFinalClass() throws Exception {
String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bh = new BindingAssertionHelper(code, true);
CPPClassType structBase = bh.assertNonProblem("Base {", 4);
assertFalse(structBase.isFinal());
IASTNode baseDefinitionName = structBase.getDefinition();
IASTNode baseDefinition = baseDefinitionName.getParent();
assertInstance(baseDefinition, ICPPASTCompositeTypeSpecifier.class);
assertFalse(((ICPPASTCompositeTypeSpecifier)baseDefinition).isFinal());
CPPClassType structS = bh.assertNonProblem("S", 1);
assertTrue(structS.isFinal());
IASTNode sDefinitionName = structS.getDefinition();
IASTNode sDefinition = sDefinitionName.getParent();
assertInstance(sDefinition, ICPPASTCompositeTypeSpecifier.class);
assertTrue(((ICPPASTCompositeTypeSpecifier)sDefinition).isFinal());
}
// struct S{
// template<typename T>
// void foo(T t) final {
// }
// };
//
// int main() {
// S s;
// s.foo(1);
// }
public void testFinalTemplateMethod() throws Exception {
String code = getAboveComment();
parseAndCheckBindings(code);
BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true);
ICPPMethod fooTemplate = bindingHelper.assertNonProblem("foo(T", 3);
assertFalse(fooTemplate.isOverride());
assertTrue(fooTemplate.isFinal());
}
// void foo(){
// int final, override;
// final = 4;
// override = 2;
// }
public void testFinalAndOverrideVariables() throws Exception {
parseAndCheckBindings();
}
// struct S{
// int i;
// };
// void foo(struct S final){
// final.i = 23;
// }
public void testFinalParameter() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -6,9 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.pdom.tests;
@ -232,4 +233,14 @@ public class ClassTests extends PDOMTestBase {
assertTrue(bindings[0] instanceof ICPPClassType);
return (ICPPClassType) bindings[0];
}
public void testFinalClass() throws Exception {
char[][] name = {"E".toCharArray()};
IBinding[] bindings = pdom.findBindings(name, IndexFilter.ALL, npm());
assertEquals(1, bindings.length);
assertInstance(bindings[0], ICPPClassType.class);
ICPPClassType classBinding = (ICPPClassType) bindings[0];
assertTrue(classBinding.isFinal());
}
}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.pdom.tests;
@ -302,4 +303,31 @@ public class MethodTests extends PDOMTestBase {
assertEquals(IBasicType.t_int, Math.min(t1, t2));
assertEquals(IBasicType.t_double, Math.max(t1, t2));
}
public void testVirtualMemberFunction() throws Exception {
IBinding[] bindings = findQualifiedName(pdom, "E::virtualMemberFunction");
assertEquals(1, bindings.length);
assertInstance(bindings[0], ICPPMethod.class);
ICPPMethod virtMemFun = (ICPPMethod) bindings[0];
assertFalse(virtMemFun.isOverride());
assertFalse(virtMemFun.isFinal());
}
public void testOverrideVirtualMemberFunction() throws Exception {
IBinding[] bindings = findQualifiedName(pdom, "F::virtualMemberFunction");
assertEquals(1, bindings.length);
assertInstance(bindings[0], ICPPMethod.class);
ICPPMethod virtMemFun = (ICPPMethod) bindings[0];
assertTrue(virtMemFun.isOverride());
assertFalse(virtMemFun.isFinal());
}
public void testOverrideFinalVirtualMemberFunction() throws Exception {
IBinding[] bindings = findQualifiedName(pdom, "G::virtualMemberFunction");
assertEquals(1, bindings.length);
assertInstance(bindings[0], ICPPMethod.class);
ICPPMethod virtMemFun = (ICPPMethod) bindings[0];
assertTrue(virtMemFun.isOverride());
assertTrue(virtMemFun.isFinal());
}
}

View file

@ -32,3 +32,6 @@ class D {
public:
D(D &) {}
};
class E final : public A {
};

View file

@ -39,6 +39,18 @@ struct B {
struct D : public A, public B {};
struct E {
virtual void virtualMemberFunction(){}
};
struct F : public E {
void virtualMemberFunction() override{}
};
struct G : public F {
void virtualMemberFunction() override final{}
};
class Class2 : public Class1 {
public:
void pureVirtualMethod();

View file

@ -181,3 +181,11 @@ decltype(i) j = 3;
int i;
typeof i j = 3;
//!CPPCompositeTypeSpecifier declared final
//%CPP
class Base
{
};
class TestClass final : public Base
{
};

View file

@ -117,3 +117,32 @@ int&& foo(int&& a)
char&& b;
}
//!ICPPASTFunctionDeclarator in member function declared final
//%CPP
struct S
{
virtual void memFun() final;
};
//!ICPPASTFunctionDeclarator in member function declared override
//%CPP
struct S
{
virtual void memFun() override;
};
//!ICPPASTFunctionDeclarator in member function declared override final
//%CPP
struct S
{
virtual void memFun() override final;
};
//!ICPPASTFunctionDeclarator in member function definition declared final
//%CPP
struct S
{
virtual void memFun() final
{
}
};

View file

@ -8,7 +8,8 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
* Thomas Corbat (IFS)
******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
@ -138,4 +139,18 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie
*/
@Override
public ICPPASTCompositeTypeSpecifier copy(CopyStyle style);
/**
* Queries whether the type is final.
*
* @since 5.5
*/
public boolean isFinal();
/**
* Sets whether the type is final.
*
* @since 5.5
*/
public void setFinal(boolean isFinal);
}

View file

@ -1,14 +1,15 @@
/*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation 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
* Copyright (c) 2004, 2012 IBM Corporation 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:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -172,4 +173,32 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
*/
@Override
public ICPPASTFunctionDeclarator copy(CopyStyle style);
/**
* Returns whether this function is declared override.
*
* @since 5.5
*/
public boolean isOverride();
/**
* Sets whether this function is declared override.
*
* @since 5.5
*/
public void setOverride(boolean isOverride);
/**
* Returns whether this function is declared final.
*
* @since 5.5
*/
public boolean isFinal();
/**
* Sets whether this function is declared final.
*
* @since 5.5
*/
public void setFinal(boolean isFinal);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -7,7 +7,8 @@
*
* Contributors:
* Doug Schaefer (IBM) - Initial API and implementation
*******************************************************************************/
* Thomas Corbat (IFS)
******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IBinding;
@ -99,4 +100,11 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* Returns an array of nested classes/structures
*/
public ICPPClassType[] getNestedClasses();
/**
* Returns whether this type is declared final.
*
* @since 5.5
*/
public boolean isFinal();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM - Initial API and implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -49,4 +50,18 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember {
* @since 5.1
*/
public boolean isPureVirtual();
/**
* Returns whether this method is declared override.
*
* @since 5.5
*/
public boolean isOverride();
/**
* Returns whether this method is declared final.
*
* @since 5.5
*/
public boolean isFinal();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2010 IBM Corporation and others.
* Copyright (c) 2002, 2012 IBM Corporation 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
@ -9,6 +9,7 @@
* John Camelon (IBM Rational Software) - Initial API and implementation
* Anton Leherbauer (Wind River Systems)
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.core.parser;
@ -167,6 +168,8 @@ public class Keywords {
public static final char[] cFALSE = "false".toCharArray();
public static final char[] cFLOAT = "float".toCharArray();
public static final char[] cFOR = "for".toCharArray();
/** @since 5.5 */
public static final char[] cFINAL = "final".toCharArray();
public static final char[] cFRIEND = "friend".toCharArray();
public static final char[] cGOTO = "goto".toCharArray();
public static final char[] cIF = "if".toCharArray();
@ -185,6 +188,8 @@ public class Keywords {
public static final char[] cOPERATOR = "operator".toCharArray();
public static final char[] cOR = "or".toCharArray();
public static final char[] cOR_EQ = "or_eq".toCharArray();
/** @since 5.5 */
public static final char[] cOVERRIDE = "override".toCharArray();
public static final char[] cPRIVATE = "private".toCharArray();
public static final char[] cPROTECTED = "protected".toCharArray();
public static final char[] cPUBLIC = "public".toCharArray();

View file

@ -148,6 +148,9 @@ public class Value implements IValue {
buf.putByte((byte) (ITypeMarshalBuffer.VALUE | ITypeMarshalBuffer.FLAG3));
buf.putLong(lv);
}
} else if (fFixedValue != null) {
buf.putByte((byte) (ITypeMarshalBuffer.VALUE | ITypeMarshalBuffer.FLAG4));
buf.putCharArray(fFixedValue);
} else {
buf.putByte((ITypeMarshalBuffer.VALUE));
fEvaluation.marshal(buf, true);
@ -169,7 +172,10 @@ public class Value implements IValue {
long val= buf.getLong();
return Value.create(val);
}
if ((firstByte & ITypeMarshalBuffer.FLAG4) != 0) {
char[] fixedValue = buf.getCharArray();
return new Value(fixedValue, null);
}
ISerializableEvaluation eval= buf.unmarshalEvaluation();
if (eval instanceof ICPPEvaluation)
return new Value(null, (ICPPEvaluation) eval);

View file

@ -178,7 +178,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
T[] newArray= array.clone();
for (int i = 0; i < newArray.length; i++) {
newArray[i]= (T) specialClass.specializeMember(array[i], point);
IBinding specializedMember = specialClass.specializeMember(array[i], point);
newArray[i]= (T) specializedMember;
}
return newArray;
}

View file

@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -36,6 +37,7 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[] baseSpecs;
private int baseSpecsPos = -1;
private boolean fAmbiguitiesResolved;
private boolean isFinal;
public CPPASTCompositeTypeSpecifier() {
}
@ -65,6 +67,7 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
copy.addMemberDeclaration(member == null ? null : member.copy(style));
for (ICPPASTBaseSpecifier baseSpecifier : getBaseSpecifiers())
copy.addBaseSpecifier(baseSpecifier == null ? null : baseSpecifier.copy(style));
copy.isFinal = isFinal;
return super.copy(copy, style);
}
@ -216,4 +219,15 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
}
}
}
@Override
public boolean isFinal() {
return isFinal;
}
@Override
public void setFinal(boolean value) {
assertNotFrozen();
isFinal = value;
}
}

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -43,7 +44,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.LookupData;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
public class CPPASTFunctionCallExpression extends ASTNode
implements ICPPASTFunctionCallExpression, IASTAmbiguityParent {
@ -301,7 +301,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length + 1];
args[0]= functionName.getEvaluation();
for (int i = 1; i < args.length; i++) {
args[i]= ((ICPPASTExpression) fArguments[i - 1]).getEvaluation();
args[i]= ((ICPPASTInitializerClause) fArguments[i - 1]).getEvaluation();
}
return new EvalFunctionCall(args);
}

View file

@ -9,6 +9,7 @@
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -42,6 +43,8 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
private boolean isVolatile;
private boolean isConst;
private boolean isMutable;
private boolean isOverride;
private boolean isFinal;
private ICPPFunctionScope scope;
@ -66,6 +69,8 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
copy.isVolatile = isVolatile;
copy.isConst = isConst;
copy.isMutable = isMutable;
copy.isOverride = isOverride;
copy.isFinal = isFinal;
for (IASTParameterDeclaration param : getParameters()) {
copy.addParameterDeclaration(param == null ? null : param.copy(style));
@ -294,4 +299,26 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
}
assert false;
}
@Override
public boolean isOverride() {
return isOverride;
}
@Override
public void setOverride(boolean value) {
assertNotFrozen();
this.isOverride = value;
}
@Override
public boolean isFinal() {
return isFinal;
}
@Override
public void setFinal(boolean value) {
assertNotFrozen();
this.isFinal = value;
}
}

View file

@ -9,6 +9,7 @@
* Andrew Niefer (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -20,24 +21,31 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
import org.eclipse.core.runtime.Assert;
@ -47,11 +55,86 @@ import org.eclipse.core.runtime.Assert;
public class CPPClassSpecialization extends CPPSpecialization
implements ICPPClassSpecialization, ICPPInternalClassTypeMixinHost {
public final static class RecursionResolvingBinding extends ProblemBinding {
public RecursionResolvingBinding(IASTNode node, char[] arg) {
public static class RecursionResolvingBinding extends ProblemBinding implements ICPPMember {
public static RecursionResolvingBinding createFor(IBinding original, IASTNode point) {
if (original instanceof ICPPMethod)
return new RecursionResolvingMethod(point, original.getNameCharArray());
if (original instanceof ICPPField)
return new RecursionResolvingField(point, original.getNameCharArray());
return new RecursionResolvingBinding(point, original.getNameCharArray());
}
private RecursionResolvingBinding(IASTNode node, char[] arg) {
super(node, IProblemBinding.SEMANTIC_RECURSION_IN_LOOKUP, arg);
Assert.isTrue(CPPASTNameBase.sAllowRecursionBindings, getMessage());
}
@Override
public int getVisibility() {
return ICPPASTVisibilityLabel.v_public;
}
@Override
public ICPPClassType getClassOwner() {
return null;
}
}
public final static class RecursionResolvingField extends RecursionResolvingBinding implements ICPPField {
public RecursionResolvingField(IASTNode node, char[] arg) {
super(node, arg);
}
@Override
public ICompositeType getCompositeTypeOwner() {
return null;
}
}
public final static class RecursionResolvingMethod extends RecursionResolvingBinding implements ICPPMethod {
public RecursionResolvingMethod(IASTNode node, char[] arg) {
super(node, arg);
}
@Override
public ICPPParameter[] getParameters() {
return ICPPParameter.EMPTY_CPPPARAMETER_ARRAY;
}
@Override
public int getRequiredArgumentCount() {
return 0;
}
@Override
public IScope getFunctionScope() {
return null;
}
@Override
public boolean isNoReturn() {
return false;
}
@Override
public boolean isDestructor() {
return false;
}
@Override
public ICPPFunctionType getType() {
return new ProblemFunctionType(getID());
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}
private ICPPClassSpecializationScope specScope;
@ -87,7 +170,7 @@ public class CPPClassSpecialization extends CPPSpecialization
fInProgress.set(set);
}
if (!set.add(original))
return new RecursionResolvingBinding(point, original.getNameCharArray());
return RecursionResolvingBinding.createFor(original, point);
}
IBinding result= CPPTemplates.createSpecialization(this, original, point);
@ -350,4 +433,13 @@ public class CPPClassSpecialization extends CPPSpecialization
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
}
@Override
public boolean isFinal() {
ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier();
if (typeSpecifier != null) {
return typeSpecifier.isFinal();
}
return false;
}
}

View file

@ -1,15 +1,16 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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:
* IBM - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* IBM - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -244,4 +245,13 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
}
return null;
}
@Override
public boolean isFinal() {
ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier();
if(typeSpecifier != null){
return typeSpecifier.isFinal();
}
return false;
}
}

View file

@ -105,6 +105,10 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
public ICPPClassType[] getNestedClasses() {
return ICPPClassType.EMPTY_CLASS_ARRAY;
}
@Override
public boolean isFinal() {
return false;
}
}
private IASTName definition;
@ -393,4 +397,13 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
}
return false;
}
@Override
public boolean isFinal() {
ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier();
if (typeSpecifier != null) {
return typeSpecifier.isFinal();
}
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
* Copyright (c) 2010, 2012 Wind River Systems, 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
@ -8,6 +8,7 @@
* Contributors:
* Markus Schorn (Wind River Systems) - initial API and implementation
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -338,6 +339,11 @@ public class CPPClosureType extends PlatformObject implements ICPPClassType, ICP
public void addDeclaration(IASTNode node) {
}
@Override
public boolean isFinal() {
return false;
}
private final class ClassScope implements ICPPClassScope {
@Override

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -8,6 +8,7 @@
* Contributors:
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -187,6 +188,16 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
return false;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
@Override
public IBinding getOwner() {
return getClassOwner();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -8,6 +8,7 @@
* Contributors:
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -225,6 +226,32 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/
@Override
public boolean isPureVirtual() {
ICPPASTFunctionDeclarator declarator = findFunctionDeclarator();
if(declarator != null){
return declarator.isPureVirtual();
}
return false;
}
@Override
public boolean isFinal() {
ICPPASTFunctionDeclarator declarator = findFunctionDeclarator();
if(declarator != null){
return declarator.isFinal();
}
return false;
}
@Override
public boolean isOverride() {
ICPPASTFunctionDeclarator declarator = findFunctionDeclarator();
if(declarator != null){
return declarator.isOverride();
}
return false;
}
private ICPPASTFunctionDeclarator findFunctionDeclarator(){
if (declarations != null) {
for (IASTDeclarator dtor : declarations) {
if (dtor == null)
@ -235,12 +262,12 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
if (decl.getParent() instanceof ICPPASTCompositeTypeSpecifier) {
dtor= ASTQueries.findTypeRelevantDeclarator(dtor);
if (dtor instanceof ICPPASTFunctionDeclarator) {
return ((ICPPASTFunctionDeclarator) dtor).isPureVirtual();
return (ICPPASTFunctionDeclarator) dtor;
}
}
}
}
return false;
return definition;
}
@Override

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -76,4 +77,14 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
public boolean isImplicit() {
return false;
}
@Override
public boolean isOverride() {
return ((ICPPMethod)getTemplateDefinition()).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod)getTemplateDefinition()).isFinal();
}
}

View file

@ -9,6 +9,7 @@
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -105,6 +106,16 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization implement
return false;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
@Override
public IType[] getExceptionSpecification(IASTNode point) {
if (isImplicit()) {

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -205,21 +206,51 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
@Override
public boolean isPureVirtual() {
if (declarations != null && declarations.length > 0) {
IASTName decl= declarations[0];
if (decl != null) {
IASTNode parent = decl.getParent();
while (!(parent instanceof IASTDeclarator) && parent != null)
parent = parent.getParent();
if (parent instanceof IASTDeclarator) {
IASTDeclarator dtor= ASTQueries.findTypeRelevantDeclarator((IASTDeclarator) parent);
if (dtor instanceof ICPPASTFunctionDeclarator) {
return ((ICPPASTFunctionDeclarator) dtor).isPureVirtual();
}
}
}
ICPPASTFunctionDeclarator functionDeclarator = findFunctionDeclarator();
if(functionDeclarator != null){
return functionDeclarator.isPureVirtual();
}
return false;
}
@Override
public boolean isOverride() {
ICPPASTFunctionDeclarator functionDeclarator = findFunctionDeclarator();
if(functionDeclarator != null){
return functionDeclarator.isOverride();
}
return false;
}
@Override
public boolean isFinal() {
ICPPASTFunctionDeclarator functionDeclarator = findFunctionDeclarator();
if(functionDeclarator != null){
return functionDeclarator.isFinal();
}
return false;
}
private ICPPASTFunctionDeclarator findFunctionDeclarator() {
IASTName target = null;
if (declarations != null && declarations.length > 0) {
target = declarations[0];
} else {
target = definition;
}
if (target != null) {
IASTNode parent = target.getParent();
while (!(parent instanceof IASTDeclarator) && parent != null)
parent = parent.getParent();
if (parent instanceof IASTDeclarator) {
IASTDeclarator dtor = ASTQueries
.findTypeRelevantDeclarator((IASTDeclarator) parent);
if (dtor instanceof ICPPASTFunctionDeclarator) {
return (ICPPASTFunctionDeclarator) dtor;
}
}
}
return null;
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -83,4 +84,13 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
return false;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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
@ -9,6 +9,7 @@
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -245,4 +246,9 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
public ICPPDeferredClassInstance asDeferredInstance() {
return null;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2012 IBM Corporation 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
@ -9,6 +9,7 @@
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Sergey Prigogin (Google)
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -129,4 +130,9 @@ public class CPPUnknownClass extends CPPUnknownBinding implements ICPPUnknownCla
public String toString() {
return ASTTypeUtil.getType(this);
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -57,4 +58,14 @@ public class CPPUnknownConstructor extends CPPUnknownFunction implements ICPPCon
public int getVisibility() {
return v_public;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -18,6 +18,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -132,6 +133,7 @@ import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@ -3295,8 +3297,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* declarator ("=" initializerClause | "(" expressionList ")")?
*
* @return declarator that this parsing produced.
* @throws BacktrackException
* request a backtrack
* @throws BacktrackException request a backtrack
* @throws FoundAggregateInitializer
*/
private IASTDeclarator initDeclarator(DtorStrategy strategy, IASTDeclSpecifier declspec, DeclarationOptions option)
@ -3305,18 +3306,21 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (option.fAllowInitializer) {
final IASTDeclarator typeRelevantDtor = ASTQueries.findTypeRelevantDeclarator(dtor);
if (option != DeclarationOptions.PARAMETER && typeRelevantDtor instanceof IASTFunctionDeclarator) {
// Function declarations don't have initializers
// For member functions we need to consider pure-virtual syntax
if (option == DeclarationOptions.CPP_MEMBER && LTcatchEOF(1) == IToken.tASSIGN
&& LTcatchEOF(2) == IToken.tINTEGER) {
consume();
IToken t = consume();
char[] image = t.getCharImage();
if (image.length != 1 || image[0] != '0') {
throwBacktrack(t);
// Function declarations don't have initializers.
// For member functions we need to consider virtual specifiers and pure-virtual syntax.
if (option == DeclarationOptions.CPP_MEMBER) {
optionalVirtSpecifierSeq((ICPPASTFunctionDeclarator) typeRelevantDtor);
int lt1 = LTcatchEOF(1);
if (lt1 == IToken.tASSIGN && LTcatchEOF(2) == IToken.tINTEGER) {
consume();
IToken t = consume();
char[] image = t.getCharImage();
if (image.length != 1 || image[0] != '0') {
throwBacktrack(t);
}
((ICPPASTFunctionDeclarator) typeRelevantDtor).setPureVirtual(true);
adjustEndOffset(dtor, t.getEndOffset()); // We can only adjust the offset of the outermost dtor.
}
((ICPPASTFunctionDeclarator) typeRelevantDtor).setPureVirtual(true);
adjustEndOffset(dtor, t.getEndOffset()); // we can only adjust the offset of the outermost dtor.
}
} else {
if (LTcatchEOF(1) == IToken.tASSIGN && LTcatchEOF(2) == IToken.tLBRACE)
@ -3346,7 +3350,37 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return dtor;
}
/**
/**
* virt-specifier-seq
* virt-specifier
* virt-specifier-seq virt-specifier
*
* virt-specifier:
* override
* final
* @throws EndOfFileException
* @throws BacktrackException
*/
private void optionalVirtSpecifierSeq(ICPPASTFunctionDeclarator typeRelevantDtor)
throws EndOfFileException, BacktrackException {
while (true) {
IToken token = LAcatchEOF(1);
if (token.getType() != IToken.tIDENTIFIER)
break;
char[] tokenImage = token.getCharImage();
if (Arrays.equals(Keywords.cOVERRIDE, tokenImage)) {
consume();
typeRelevantDtor.setOverride(true);
} else if (Arrays.equals(Keywords.cFINAL, tokenImage)) {
consume();
typeRelevantDtor.setFinal(true);
} else {
break;
}
}
}
/**
* initializer:
* brace-or-equal-initializer
* ( expression-list )
@ -4070,6 +4104,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
ICPPASTCompositeTypeSpecifier astClassSpecifier = nodeFactory.newCompositeTypeSpecifier(classKind, name);
// class virt specifier
if(LT(1) == IToken.tIDENTIFIER) {
classVirtSpecifier(astClassSpecifier);
}
// base clause
if (LT(1) == IToken.tCOLON) {
baseClause(astClassSpecifier);
@ -4134,7 +4173,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
consume();
}
}
/**
* Parse a class virtual specifier for a class specification.
* class-virt-specifier:
* final
* @param astClassSpecifier
*/
private void classVirtSpecifier(ICPPASTCompositeTypeSpecifier astClassSpecifier) throws EndOfFileException, BacktrackException {
IToken token = LA();
char[] tokenImage = token.getCharImage();
if(token.getType() == IToken.tIDENTIFIER && Arrays.equals(Keywords.cFINAL, tokenImage)){
consume();
astClassSpecifier.setFinal(true);
}
}
/**
* base-specifier:
* ::? nested-name-specifier? class-name

View file

@ -303,9 +303,11 @@ public class EvalID extends CPPEvaluation {
if (templateArgs == fTemplateArgs && fieldOwner == fFieldOwner && nameOwner == fNameOwner)
return this;
ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, templateArgs, point);
if (eval != null)
return eval;
if (nameOwner instanceof ICPPClassType) {
ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, templateArgs, point);
if (eval != null)
return eval;
}
return new EvalID(fieldOwner, nameOwner, fName, fAddressOf, fQualified, templateArgs);
}

View file

@ -9,6 +9,7 @@
* Contributors:
* Institute for Software - initial API and implementation
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@ -230,6 +231,10 @@ public class DeclSpecWriter extends NodeWriter {
compDeclSpec.getName().accept(visitor);
if (compDeclSpec instanceof ICPPASTCompositeTypeSpecifier) {
ICPPASTCompositeTypeSpecifier cppComp = (ICPPASTCompositeTypeSpecifier) compDeclSpec;
if (cppComp.isFinal()) {
scribe.printSpace();
scribe.print(Keywords.cFINAL);
}
ICPPASTBaseSpecifier[] baseSpecifiers = cppComp.getBaseSpecifiers();
if (baseSpecifiers.length > 0) {
scribe.print(SPACE_COLON_SPACE);

View file

@ -10,6 +10,7 @@
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@ -140,6 +141,14 @@ public class DeclaratorWriter extends NodeWriter {
scribe.printSpace();
scribe.print(Keywords.MUTABLE);
}
if (funcDec.isOverride()) {
scribe.printSpace();
scribe.print(Keywords.cOVERRIDE);
}
if (funcDec.isFinal()) {
scribe.printSpace();
scribe.print(Keywords.cFINAL);
}
if (funcDec.isPureVirtual()) {
scribe.print(PURE_VIRTUAL);
}

View file

@ -160,7 +160,7 @@ public class CIndex implements IIndex {
@Override
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException {
LinkedList<IIndexFragmentName> result= new LinkedList<IIndexFragmentName>();
ArrayList<IIndexFragmentName> result= new ArrayList<IIndexFragmentName>();
if (binding instanceof ICPPUsingDeclaration) {
IBinding[] bindings= ((ICPPUsingDeclaration) binding).getDelegates();
if (bindings == null || bindings.length == 0) {
@ -180,7 +180,7 @@ public class CIndex implements IIndex {
// variants in one or more index fragments, we need to filter out duplicate names.
// See bug 192352.
// Read only fragments can be superseded by what the indexer writes into
// a writable fragment. Therefore names from a read-only fragement are
// a writable fragment. Therefore names from a read-only fragment are
// ignored if there is a match in a writable fragment.
HashSet<NameKey> encounteredNames = new HashSet<NameKey>();
for (IIndexFragment fragment : fFragments) {

View file

@ -114,8 +114,7 @@ public class CompositeCPPClassSpecialization extends CompositeCPPClassType imple
fInProgress.set(set);
}
if (!set.add(original))
return new RecursionResolvingBinding(null, null);
return RecursionResolvingBinding.createFor(original, point);
}
IBinding newSpec= CPPTemplates.createSpecialization(this, original, point);
set.remove(original);

View file

@ -9,6 +9,7 @@
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -184,4 +185,9 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
}
return result;
}
@Override
public boolean isFinal() {
return ((ICPPClassType) rbinding).isFinal();
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -24,37 +25,47 @@ class CompositeCPPMethod extends CompositeCPPFunction implements ICPPMethod {
@Override
public boolean isDestructor() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public boolean isImplicit() {
return ((ICPPMethod)rbinding).isImplicit();
return ((ICPPMethod) rbinding).isImplicit();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)rbinding).isExplicit();
return ((ICPPMethod) rbinding).isExplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)rbinding).isVirtual();
return ((ICPPMethod) rbinding).isVirtual();
}
@Override
public ICPPClassType getClassOwner() {
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod) rbinding).getClassOwner();
return (ICPPClassType) cf.getCompositeBinding(rowner);
}
@Override
public int getVisibility() {
return ((ICPPMethod)rbinding).getVisibility();
return ((ICPPMethod) rbinding).getVisibility();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)rbinding).isPureVirtual();
return ((ICPPMethod) rbinding).isPureVirtual();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) rbinding).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) rbinding).isFinal();
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -23,37 +24,47 @@ public class CompositeCPPMethodInstance extends CompositeCPPFunctionInstance imp
@Override
public boolean isDestructor() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public boolean isImplicit() {
return ((ICPPMethod)rbinding).isImplicit();
return ((ICPPMethod) rbinding).isImplicit();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)rbinding).isExplicit();
return ((ICPPMethod) rbinding).isExplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public ICPPClassType getClassOwner() {
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod) rbinding).getClassOwner();
return (ICPPClassType) cf.getCompositeBinding(rowner);
}
@Override
public int getVisibility() {
return ((ICPPMethod)rbinding).getVisibility();
return ((ICPPMethod) rbinding).getVisibility();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)rbinding).isPureVirtual();
return ((ICPPMethod) rbinding).isPureVirtual();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) rbinding).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) rbinding).isFinal();
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -16,45 +17,54 @@ import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
public class CompositeCPPMethodSpecialization extends CompositeCPPFunctionSpecialization
implements ICPPMethod {
implements ICPPMethod {
public CompositeCPPMethodSpecialization(ICompositesFactory cf, ICPPMethod method) {
super(cf, method);
}
@Override
public boolean isDestructor() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public boolean isImplicit() {
return ((ICPPMethod)rbinding).isImplicit();
return ((ICPPMethod) rbinding).isImplicit();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)rbinding).isExplicit();
return ((ICPPMethod) rbinding).isExplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)rbinding).isVirtual();
return ((ICPPMethod) rbinding).isVirtual();
}
@Override
public ICPPClassType getClassOwner() {
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod) rbinding).getClassOwner();
return (ICPPClassType) cf.getCompositeBinding(rowner);
}
@Override
public int getVisibility() {
return ((ICPPMethod)rbinding).getVisibility();
return ((ICPPMethod) rbinding).getVisibility();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)rbinding).isPureVirtual();
return ((ICPPMethod) rbinding).isPureVirtual();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) rbinding).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) rbinding).isFinal();
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -23,39 +24,47 @@ public class CompositeCPPMethodTemplate extends CompositeCPPFunctionTemplate imp
@Override
public boolean isDestructor() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public boolean isImplicit() {
return ((ICPPMethod)rbinding).isImplicit();
return ((ICPPMethod) rbinding).isImplicit();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)rbinding).isExplicit();
return ((ICPPMethod) rbinding).isExplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)rbinding).isVirtual();
return ((ICPPMethod) rbinding).isVirtual();
}
@Override
public ICPPClassType getClassOwner() {
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod) rbinding).getClassOwner();
return (ICPPClassType) cf.getCompositeBinding(rowner);
}
@Override
public int getVisibility() {
return ((ICPPMethod)rbinding).getVisibility();
return ((ICPPMethod) rbinding).getVisibility();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)rbinding).isPureVirtual();
return ((ICPPMethod) rbinding).isPureVirtual();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) rbinding).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) rbinding).isFinal();
}
}

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -17,47 +18,55 @@ import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
public class CompositeCPPMethodTemplateSpecialization
extends CompositeCPPFunctionTemplateSpecialization
implements ICPPMethod {
public CompositeCPPMethodTemplateSpecialization(ICompositesFactory cf,
ICPPFunction ft) {
extends CompositeCPPFunctionTemplateSpecialization
implements ICPPMethod {
public CompositeCPPMethodTemplateSpecialization(ICompositesFactory cf, ICPPFunction ft) {
super(cf, ft);
}
@Override
public boolean isDestructor() {
return ((ICPPMethod)rbinding).isDestructor();
return ((ICPPMethod) rbinding).isDestructor();
}
@Override
public boolean isImplicit() {
return ((ICPPMethod)rbinding).isImplicit();
return ((ICPPMethod) rbinding).isImplicit();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)rbinding).isExplicit();
return ((ICPPMethod) rbinding).isExplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)rbinding).isVirtual();
return ((ICPPMethod) rbinding).isVirtual();
}
@Override
public ICPPClassType getClassOwner() {
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod) rbinding).getClassOwner();
return (ICPPClassType) cf.getCompositeBinding(rowner);
}
@Override
public int getVisibility() {
return ((ICPPMethod)rbinding).getVisibility();
return ((ICPPMethod) rbinding).getVisibility();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)rbinding).isPureVirtual();
return ((ICPPMethod) rbinding).isPureVirtual();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) rbinding).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) rbinding).isFinal();
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Symbian Software Systems and others.
* Copyright (c) 2007, 2012 Symbian Software Systems 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:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -35,8 +36,7 @@ import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
implements ICPPTemplateTemplateParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType {
implements ICPPTemplateTemplateParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType {
private ICPPScope unknownScope;
public CompositeCPPTemplateTemplateParameter(ICompositesFactory cf, ICPPTemplateTemplateParameter binding) {
@ -45,33 +45,33 @@ public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
@Override
public IType getDefault() throws DOMException {
IType preresult= ((ICPPTemplateTemplateParameter)rbinding).getDefault();
IType preresult= ((ICPPTemplateTemplateParameter) rbinding).getDefault();
return cf.getCompositeType(preresult);
}
@Override
public short getParameterPosition() {
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
return ((ICPPTemplateParameter) rbinding).getParameterPosition();
}
@Override
public short getTemplateNestingLevel() {
return ((ICPPTemplateParameter)rbinding).getTemplateNestingLevel();
return ((ICPPTemplateParameter) rbinding).getTemplateNestingLevel();
}
@Override
public int getParameterID() {
return ((ICPPTemplateParameter)rbinding).getParameterID();
return ((ICPPTemplateParameter) rbinding).getParameterID();
}
@Override
public boolean isParameterPack() {
return ((ICPPTemplateParameter)rbinding).isParameterPack();
return ((ICPPTemplateParameter) rbinding).isParameterPack();
}
@Override
public boolean isSameType(IType type) {
return ((IType)rbinding).isSameType(type);
return ((IType) rbinding).isSameType(type);
}
@Override
@ -95,7 +95,7 @@ public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
@Override
public ICPPTemplateArgument getDefaultValue() {
try {
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter)rbinding).getDefaultValue());
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter) rbinding).getDefaultValue());
} catch (DOMException e) {
return null;
}
@ -103,7 +103,7 @@ public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
@Override
public ICPPTemplateParameter[] getTemplateParameters() {
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter)rbinding).getTemplateParameters());
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter) rbinding).getTemplateParameters());
}
@Override
@ -180,4 +180,9 @@ public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
public ICPPDeferredClassInstance asDeferredInstance() {
return null;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Google, Inc and others.
* Copyright (c) 2008, 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
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -140,4 +141,9 @@ class CompositeCPPUnknownClassType extends CompositeCPPUnknownBinding implements
public boolean isAnonymous() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -221,10 +221,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* CDT 8.2 development (versions not supported on the 8.1.x branch)
* 130.0 - Dependent expressions, bug 299911.
* 131.0 - Dependent expressions part 2, bug 299911.
* 132.0 - Explicit virtual overrides, bug 380623.
*/
private static final int MIN_SUPPORTED_VERSION= version(131, 0);
private static final int MAX_SUPPORTED_VERSION= version(131, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(131, 0);
private static final int MIN_SUPPORTED_VERSION= version(132, 0);
private static final int MAX_SUPPORTED_VERSION= version(132, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(132, 0);
private static int version(int major, int minor) {
return (major << 16) + minor;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 QNX Software Systems and others.
* Copyright (c) 2005, 2012 QNX Software Systems 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
@ -26,4 +26,8 @@ public class DBStatus extends Status {
public DBStatus(IOException exception) {
super(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, "IOException", exception); //$NON-NLS-1$
}
public DBStatus(String msg) {
super(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, "Error", null); //$NON-NLS-1$
}
}

View file

@ -29,6 +29,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import com.ibm.icu.text.MessageFormat;
/**
* Database encapsulates access to a flat binary format file with a memory-manager-like API for
* obtaining and releasing areas of storage (memory).
@ -263,7 +265,10 @@ public class Database {
synchronized (fCache) {
assert fLocked;
final int index = (int)long_index;
final int index = (int) long_index;
if (index < 0 || index >= fChunks.length) {
databaseCorruptionDetected();
}
Chunk chunk= fChunks[index];
if (chunk == null) {
cacheMisses++;
@ -277,6 +282,12 @@ public class Database {
}
}
private void databaseCorruptionDetected() throws CoreException {
String msg = MessageFormat.format(Messages.getString("Database.CorruptedDatabase"), //$NON-NLS-1$
new Object[] { fLocation.getName() });
throw new CoreException(new DBStatus(msg));
}
/**
* Allocate a block out of the database.
*/

View file

@ -16,3 +16,4 @@ BTree.IntegrityErrorA=[{0} blanks inconsistent b={1} nb={2}]
BTree.IntegrityErrorB=[{0} wrong number of children with respect to key count]
BTree.IntegrityErrorC=[{0} key count out of range]
BTree.IntegrityErrorD=Leaf nodes at differing depths
Database.CorruptedDatabase=Corrupted database: {0}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
@ -615,6 +616,11 @@ public class PDOMASTAdapter {
public boolean isAnonymous() {
return ((ICPPClassType) fDelegate).isAnonymous();
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2010 IBM Corporation.
* Copyright (c) 2006, 2012 IBM Corporation.
* 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
@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -38,7 +39,9 @@ class PDOMCPPAnnotation {
public static final int IMPLICIT_METHOD_OFFSET = 2;
public static final int EXPLICIT_METHOD_OFFSET = 3;
public static final int PURE_VIRTUAL_OFFSET = 4;
public static final int MAX_EXTRA_OFFSET= PURE_VIRTUAL_OFFSET;
public static final int OVERRIDE_OFFSET = 5;
public static final int FINAL_OFFSET = 6;
public static final int MAX_EXTRA_OFFSET= FINAL_OFFSET;
/**
* Encodes storage class specifiers and other annotation, including
@ -92,6 +95,8 @@ class PDOMCPPAnnotation {
modifiers |= (method.isImplicit() ? 1 : 0) << IMPLICIT_METHOD_OFFSET;
modifiers |= (method.isPureVirtual() ? 1 : 0) << PURE_VIRTUAL_OFFSET;
modifiers |= (method.isExplicit() ? 1 : 0) << EXPLICIT_METHOD_OFFSET;
modifiers |= (method.isOverride() ? 1 : 0) << OVERRIDE_OFFSET;
modifiers |= (method.isFinal() ? 1 : 0) << FINAL_OFFSET;
}
return modifiers;
}

View file

@ -10,6 +10,7 @@
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -57,12 +58,13 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
ICPPClassSpecialization, IPDOMMemberOwner, IPDOMCPPClassType {
private static final int FIRST_BASE = PDOMCPPSpecialization.RECORD_SIZE + 0;
private static final int MEMBER_LIST = PDOMCPPSpecialization.RECORD_SIZE + 4;
private static final int FINAL = PDOMCPPSpecialization.RECORD_SIZE + 8; // byte
/**
* The size in bytes of a PDOMCPPClassSpecialization record in the database.
*/
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 8;
protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 9;
private volatile ICPPClassScope fScope;
private ObjectMap specializationMap; // Obtained from the synchronized PDOM cache
@ -71,12 +73,22 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
public PDOMCPPClassSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPClassType classType,
PDOMBinding specialized) throws CoreException {
super(linkage, parent, (ICPPSpecialization) classType, specialized);
setFinal(classType);
}
public PDOMCPPClassSpecialization(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord);
}
@Override
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPClassType) {
ICPPClassType ct= (ICPPClassType) newBinding;
setFinal(ct);
super.update(linkage, newBinding);
}
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
@ -100,7 +112,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
@Override
public IBinding specializeMember(IBinding original, IASTNode point) {
if (specializationMap == null) {
final Long key= record+PDOMCPPLinkage.CACHE_INSTANCE_SCOPE;
final Long key= record + PDOMCPPLinkage.CACHE_INSTANCE_SCOPE;
Object cached= getPDOM().getCachedResult(key);
if (cached != null) {
specializationMap= (ObjectMap) cached;
@ -132,7 +144,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
fInProgress.set(set);
}
if (!set.add(original))
return new RecursionResolvingBinding(null, null);
return RecursionResolvingBinding.createFor(original, point);
}
IBinding newSpec= CPPTemplates.createSpecialization(this, original, point);
set.remove(original);
@ -177,14 +189,14 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
}
public void addBase(PDOMCPPBase base) throws CoreException {
getPDOM().removeCachedResult(record+PDOMCPPLinkage.CACHE_BASES);
getPDOM().removeCachedResult(record + PDOMCPPLinkage.CACHE_BASES);
PDOMCPPBase firstBase = getFirstBase();
base.setNextBase(firstBase);
setFirstBase(base);
}
public void removeBase(PDOMName pdomName) throws CoreException {
getPDOM().removeCachedResult(record+PDOMCPPLinkage.CACHE_BASES);
getPDOM().removeCachedResult(record + PDOMCPPLinkage.CACHE_BASES);
PDOMCPPBase base= getFirstBase();
PDOMCPPBase predecessor= null;
long nameRec= pdomName.getRecord();
@ -435,4 +447,18 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
public boolean isAnonymous() {
return false;
}
@Override
public boolean isFinal() {
try {
return getDB().getByte(record + FINAL) != 0;
} catch (CoreException e){
CCorePlugin.log(e);
return false;
}
}
private void setFinal(ICPPClassType ct) throws CoreException {
getDB().putByte(record + FINAL, (byte) (ct.isFinal() ? 1 : 0));
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2011 QNX Software Systems and others.
* Copyright (c) 2005, 2012 QNX Software Systems 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
@ -11,6 +11,7 @@
* Andrew Ferguson (Symbian)
* Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -52,8 +53,9 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
private static final int FIRSTFRIEND = PDOMCPPBinding.RECORD_SIZE + 8;
private static final int KEY = PDOMCPPBinding.RECORD_SIZE + 12; // byte
private static final int ANONYMOUS= PDOMCPPBinding.RECORD_SIZE + 13; // byte
private static final int FINAL = PDOMCPPBinding.RECORD_SIZE + 14; // byte
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 14;
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 15;
private PDOMCPPClassScope fScope; // No need for volatile, all fields of PDOMCPPClassScope are final.
@ -62,6 +64,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
setKind(classType);
setAnonymous(classType);
setFinal(classType);
// linked list is initialized by storage being zero'd by malloc
}
@ -85,6 +88,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
ICPPClassType ct= (ICPPClassType) newBinding;
setKind(ct);
setAnonymous(ct);
setFinal(ct);
super.update(linkage, newBinding);
}
}
@ -97,6 +101,10 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0));
}
private void setFinal(ICPPClassType ct) throws CoreException {
getDB().putByte(record + FINAL, (byte) (ct.isFinal() ? 1 : 0));
}
@Override
public boolean mayHaveChildren() {
return true;
@ -231,6 +239,16 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
}
}
@Override
public boolean isFinal() {
try {
return getDB().getByte(record + FINAL) != 0;
} catch (CoreException e){
CCorePlugin.log(e);
return false;
}
}
@Override
public boolean isSameType(IType type) {
if (type instanceof ITypedef) {

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 QNX Software Systems and others.
* Copyright (c) 2007, 2012 QNX Software Systems 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:
* Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -211,6 +212,11 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization
return (ICPPTemplateDefinition) getSpecializedBinding();
}
@Override
public boolean isFinal() {
return getClassTemplate().isFinal();
}
@Override
public ICPPTemplateArgument[] getTemplateArguments() {
try {

View file

@ -1,15 +1,16 @@
/*******************************************************************************
* Copyright (c) 2006, 2011 QNX Software Systems and others.
* Copyright (c) 2006, 2012 QNX Software Systems 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:
* Doug Schaefer (QNX) - Initial API and implementation
* IBM Corporation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
* Doug Schaefer (QNX) - Initial API and implementation
* IBM Corporation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -257,4 +258,14 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
}
return super.getExceptionSpecification();
}
@Override
public boolean isOverride() {
return getBit(getAnnotation1(), PDOMCPPAnnotation.OVERRIDE_OFFSET);
}
@Override
public boolean isFinal() {
return getBit(getAnnotation1(), PDOMCPPAnnotation.FINAL_OFFSET);
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2012 QNX Software Systems 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:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -21,10 +22,8 @@ import org.eclipse.core.runtime.CoreException;
/**
* @author Bryan Wilkinson
*
*/
class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMethod {
/**
* The size in bytes of a PDOMCPPMethodInstance record in the database.
*/
@ -52,7 +51,7 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho
@Override
public boolean isDestructor() {
return ((ICPPMethod)getTemplateDefinition()).isDestructor();
return ((ICPPMethod) getTemplateDefinition()).isDestructor();
}
@Override
@ -62,22 +61,22 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho
@Override
public boolean isImplicit() {
return ((ICPPMethod)getTemplateDefinition()).isImplicit();
return ((ICPPMethod) getTemplateDefinition()).isImplicit();
}
@Override
public boolean isVirtual() {
return ((ICPPMethod)getTemplateDefinition()).isVirtual();
return ((ICPPMethod) getTemplateDefinition()).isVirtual();
}
@Override
public boolean isPureVirtual() {
return ((ICPPMethod)getTemplateDefinition()).isPureVirtual();
return ((ICPPMethod) getTemplateDefinition()).isPureVirtual();
}
@Override
public boolean isExplicit() {
return ((ICPPMethod)getTemplateDefinition()).isExplicit();
return ((ICPPMethod) getTemplateDefinition()).isExplicit();
}
@Override
@ -87,6 +86,16 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho
@Override
public int getVisibility() {
return ((ICPPMethod)getTemplateDefinition()).getVisibility();
return ((ICPPMethod) getTemplateDefinition()).getVisibility();
}
@Override
public boolean isOverride() {
return ((ICPPMethod) getTemplateDefinition()).isOverride();
}
@Override
public boolean isFinal() {
return ((ICPPMethod) getTemplateDefinition()).isFinal();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2012 QNX Software Systems 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
@ -8,6 +8,7 @@
* Contributors:
* Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -142,4 +143,14 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization
}
return super.getExceptionSpecification();
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2012 QNX Software Systems 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:
* Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -150,4 +151,14 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho
public boolean isPureVirtual() {
return false;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,13 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2012 QNX Software Systems 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:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -101,4 +102,14 @@ class PDOMCPPMethodTemplateSpecialization extends
public boolean isPureVirtual() {
return false;
}
@Override
public boolean isOverride() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -339,6 +340,11 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
return false;
}
@Override
public boolean isFinal() {
return false;
}
@Override
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
int pos = param.getParameterPosition();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 Google, Inc and others.
* Copyright (c) 2008, 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
@ -8,6 +8,7 @@
* Contributors:
* Sergey Prigogin (Google) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -285,4 +286,9 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding
public boolean isAnonymous() {
return false;
}
@Override
public boolean isFinal() {
return false;
}
}

View file

@ -58,18 +58,23 @@ public abstract class UNCPathConverter {
/**
* Convert a URI to an IPath. If URI has a host section, return a UNC rather than a file based path.
* Convert a URI to an IPath.
* Resolves to local path if possible, including using EFS where required.
*
* @param uri
* URI to convert to an IPath
* @return IPath representation of the URI
*/
public static IPath toPath(URI uri) {
IPath localPath = URIUtil.toPath(uri);
String host = uri.getHost();
if (host != null) {
// try local path first
// that'll give EFS a chance to resolve a custom protocol path.
if (host != null && localPath == null) {
return new Path(host + uri.getPath()).makeUNC(true);
}
return URIUtil.toPath(uri);
} else {
return localPath;
}
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 QNX Software Systems and others.
* Copyright (c) 2000, 2012 QNX Software Systems 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
@ -133,6 +133,8 @@ public class Elf {
public final static int EM_MSP430 = 105;
public final static int EM_BLACKFIN = 106;
public final static int EM_EXCESS = 111;
/** @since 5.5 */
public final static int EM_ESIRISC = 111;
public final static int EM_NIOSII = 113;
public final static int EM_C166 = 116;
public final static int EM_M16C = 117;
@ -803,8 +805,8 @@ public class Elf {
case Elf.ELFhdr.EM_IQ2000 :
attrib.cpu = "iq2000"; //$NON-NLS-1$
break;
case Elf.ELFhdr.EM_EXCESS :
attrib.cpu = "excess"; //$NON-NLS-1$
case Elf.ELFhdr.EM_ESIRISC :
attrib.cpu = "esirisc"; //$NON-NLS-1$
break;
case Elf.ELFhdr.EM_NIOSII :
attrib.cpu = "alteranios2"; //$NON-NLS-1$

View file

@ -17,11 +17,11 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -438,8 +438,7 @@ public class AddIncludeOnSelectionAction extends TextEditorAction {
if (isWorkspaceFile(headerFile.getLocation().getURI())) {
return headerFile;
}
// TODO(sprigogin): Change to ArrayDeque when Java 5 support is no longer needed.
LinkedList<IIndexFile> front = new LinkedList<IIndexFile>();
ArrayDeque<IIndexFile> front = new ArrayDeque<IIndexFile>();
front.add(headerFile);
HashSet<IIndexFile> processed = new HashSet<IIndexFile>();
processed.add(headerFile);

View file

@ -1,11 +1,11 @@
###############################################################################
# Copyright (c) 2005, 2010 IBM Corporation 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
# Copyright (c) 2005, 2010 IBM Corporation 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:
# Contributors:
# IBM Corporation - initial API and implementation
# QNX Software System
# Anton Leherbauer (Wind River Systems)
@ -14,13 +14,13 @@
# Tomasz Wesolowski
###############################################################################
AddIncludeOnSelection.label=A&dd Include
AddIncludeOnSelection.description=Add include statement for selected name
AddIncludeOnSelection.label=Add Include
AddIncludeOnSelection.tooltip=Add Include Statement for Selected Name
AddIncludeOnSelection.tooltip=Adds an include statement for selected name
SortLines.description=Sort selected lines alphabetically
SortLines.label=Sort Lines
SortLines.tooltip=Sort Selected Lines Alphabetically
SortLines.description=Sorts selected lines alphabetically
OpenOutline.label= Quick Out&line
OpenOutline.tooltip= Shows the Quick Outline of Editor Input
@ -47,11 +47,11 @@ ContentAssistProposal.description=Content Assist
ContentAssistContextInformation.label=Parameter &Hints
ContentAssistContextInformation.tooltip=Show Parameter Hints
ContentAssistContextInformation.description=Show Method Parameter Hints
ContentAssistContextInformation.description=Shows method parameter hints
ToggleComment.label=Togg&le Comment
ToggleComment.tooltip=Toggle Comment For the Selected Lines
ToggleComment.description=Toggle Comment for the selected lines
ToggleComment.description=Toggles comment for the selected lines
AddBlockComment.label=Add &Block Comment
AddBlockComment.tooltip=Enclose the Selection in a Block Comment
@ -63,7 +63,7 @@ RemoveBlockComment.description=Removes any block comment markers enclosing the c
Format.label=F&ormat
Format.tooltip=Format the Selected Text
Format.description=Format the selected text
Format.description=Formats the selected text
ShiftRight.label=Sh&ift Right
ShiftRight.tooltip=Shift Right
@ -71,7 +71,7 @@ ShiftRight.description=Shift the selected text to the right
ShiftLeft.label=S&hift Left
ShiftLeft.tooltip=Shift Left
ShiftLeft.description=Shift the selected text to the left
ShiftLeft.description=Shifts the selected text to the left
NextAnnotation.label= Ne&xt Annotation
NextAnnotation.tooltip= Next Annotation
@ -87,23 +87,23 @@ Indent.description=&Indents the current line or selection depending on surroundi
GotoNextMember.label= N&ext Member
GotoNextMember.tooltip=Move the Caret to the Next Member of the Translation Unit
GotoNextMember.description=Move the caret to the next member of the translation unit
GotoNextMember.description=Moves the caret to the next member of the translation unit
GotoPreviousMember.label= Previ&ous Member
GotoPreviousMember.tooltip=Move the Caret to the Previous Member of the Translation Unit
GotoPreviousMember.description=Move the caret to the previous member of the translation unit
GotoPreviousMember.description=Moves the caret to the previous member of the translation unit
GotoMatchingBracket.label= Matching &Bracket
GotoMatchingBracket.tooltip=Go to Matching Bracket
GotoMatchingBracket.description=Go to Matching Bracket
GotoMatchingBracket.description=Moves the caret to the matching bracket
GotoNextBookmark.description=Goto next bookmark of the selected file
GotoNextBookmark.label=Next Bookmark
GotoNextBookmark.tooltip=Goto Next Bookmark of the Selected File
GotoNextBookmark.tooltip=Go to Next Bookmark
GotoNextBookmark.description=Moves selection to the next bookmark of the selected file
FindWord.description=Select a word and find the next occurrence
FindWord.label=Find Word
FindWord.tooltip=Select a Word and Find the Next Occurrence
FindWord.tooltip=Selects a Word and Find the Next Occurrence
FindWord.description=Selects a word and find the next occurrence
ToggleInsertMode.label=Sma&rt Insert Mode
ToggleInsertMode.tooltip=Toggle Smart Insert Mode
@ -135,19 +135,19 @@ CSelectAnnotationRulerAction.GotoAnnotation.image=
StructureSelectNext.label=&Next Element
StructureSelectNext.tooltip=Expand Selection to Include Next Sibling
StructureSelectNext.description=Expand selection to include next sibling
StructureSelectNext.description=Expands selection to include next sibling
StructureSelectPrevious.label=&Previous Element
StructureSelectPrevious.tooltip=Expand Selection to Include Previous Sibling
StructureSelectPrevious.description=Expand selection to include previous sibling
StructureSelectPrevious.description=Expands selection to include previous sibling
StructureSelectEnclosing.label=&Enclosing Element
StructureSelectEnclosing.tooltip=Expand Selection to Include Enclosing Element
StructureSelectEnclosing.description=Expand selection to include enclosing element
StructureSelectEnclosing.description=Expands selection to include enclosing element
StructureSelectHistory.label=&Restore Last Selection
StructureSelectHistory.tooltip=Restore Last Selection
StructureSelectHistory.description=Restore last selection
StructureSelectHistory.description=Restores last selection
CSelectAnnotationRulerAction.OpenSuperImplementation.label= &Open Super Implementation
CSelectAnnotationRulerAction.OpenSuperImplementation.tooltip= Open Super Implementation

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2012 Intel Corporation, QNX Software Systems, and others.
* Copyright (c) 2007, 2010 Intel Corporation, QNX Software Systems, 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
@ -11,7 +11,6 @@
* Andrew Gvozdev
* QNX Software Systems - [271628] NPE in configs for project that failed to convert
* James Blackburn (Broadcom Corp.)
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
@ -52,7 +51,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -776,7 +774,7 @@ implements
if (cfgDescs[i].isActive()) {
name = name + " " + Messages.AbstractPage_16; //$NON-NLS-1$
}
configSelector.add(TextProcessor.process(name));
configSelector.add(name);
}
// Ensure that the last selected config is selected by default

View file

@ -21,12 +21,14 @@ import java.util.List;
import org.eclipse.cdt.debug.core.breakpointactions.BreakpointActionManager;
import org.eclipse.cdt.debug.core.command.CCommandAdapterFactory;
import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.CProjectSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer;
import org.eclipse.cdt.debug.internal.core.DebugConfiguration;
import org.eclipse.cdt.debug.internal.core.DebugModelProvider;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.ListenerList;
import org.eclipse.cdt.debug.internal.core.SessionManager;
@ -348,6 +350,8 @@ public class CDebugCorePlugin extends Plugin {
createDisassemblyContextService();
setSessionManager(new SessionManager());
setDefaultLaunchDelegates();
Platform.getAdapterManager().registerAdapters(new DebugModelProvider(), ICDebugElement.class);
}
/* (non-Javadoc)

View file

@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems 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:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.model.IDebugModelProvider;
/**
* Debug model provider returns additional model ID to use with
* GDB event breakpoints.
*/
@SuppressWarnings("rawtypes")
public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory {
private final static Class[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class };
private final static String GDB_MODEL_ID = "org.eclipse.cdt.gdb"; //$NON-NLS-1$
private final static String[] MODEL_IDS = new String[] { CDIDebugModel.getPluginIdentifier(), GDB_MODEL_ID };
@Override
public String[] getModelIdentifiers() {
return MODEL_IDS;
}
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if ( adaptableObject instanceof ICDebugElement && IDebugModelProvider.class.equals(adapterType) ) {
return this;
}
return null;
}
@Override
public Class[] getAdapterList() {
return ADAPTER_LIST;
}
}

View file

@ -3,7 +3,7 @@
<plugin>
<extension point="org.eclipse.cdt.debug.ui.breakpointContribution">
<breakpointLabels
debugModelId="org.eclipse.cdt.debug.core"
debugModelId="org.eclipse.cdt.gdb"
markerType="org.eclipse.cdt.debug.core.cEventBreakpointMarker">
<attribute name="org.eclipse.cdt.debug.core.eventbreakpoint_event_id" label="%catchType.label" type="string">
<value

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -13,15 +13,14 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
import org.eclipse.osgi.util.NLS;
/**
* @since 1.0
* @since 1.1
*/
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.messages"; //$NON-NLS-1$
public static String MulticoreVisualizer_name;
public static String MulticoreVisualizer_tooltip;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
NLS.initializeMessages(Messages.class.getName(), Messages.class);
}
private Messages() {

View file

@ -9,4 +9,4 @@
# IBM Corporation - initial API and implementation
###############################################################################
MulticoreVisualizer_name=Multicore Visualizer
MulticoreVisualizer_tooltip=Displays current state of selected debug target.
MulticoreVisualizer_tooltip=Displays current state of selected debug target

View file

@ -204,7 +204,7 @@ public class GdbAdapterFactory
// @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers()
@Override
public String[] getModelIdentifiers() {
return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID };
return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID, "org.eclipse.cdt.gdb" }; //$NON-NLS-1$
}
};
session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);

View file

@ -214,6 +214,8 @@ public class TraceControlView extends ViewPart implements IViewPart, SessionEnde
getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, fDebugViewListener);
fStatusText = null; // Indicate that we have been disposed
setDebugContext(null);
DsfSession.removeSessionEndedListener(this);
super.dispose();
}