diff --git a/build/org.eclipse.cdt.autotools.core/ChangeLog b/build/org.eclipse.cdt.autotools.core/ChangeLog index 70f4ce00a68..b6294012348 100644 --- a/build/org.eclipse.cdt.autotools.core/ChangeLog +++ b/build/org.eclipse.cdt.autotools.core/ChangeLog @@ -1,3 +1,9 @@ +2012-08-29 Jeff Johnston + + 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 * src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java: New file. diff --git a/build/org.eclipse.cdt.autotools.core/plugin.properties b/build/org.eclipse.cdt.autotools.core/plugin.properties index 6a3682f1b7c..ee71b8e0baa 100644 --- a/build/org.eclipse.cdt.autotools.core/plugin.properties +++ b/build/org.eclipse.cdt.autotools.core/plugin.properties @@ -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) diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java index 2d628ebaa4f..40dfb2f30f7 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java @@ -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); } } diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties index c317733fc4d..9da9505b256 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties @@ -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) diff --git a/build/org.eclipse.cdt.autotools.docs/CDT/Autotools/User_Guide/Invoking-Autotools.html b/build/org.eclipse.cdt.autotools.docs/CDT/Autotools/User_Guide/Invoking-Autotools.html index 5f2868ef800..196c529d1e6 100644 --- a/build/org.eclipse.cdt.autotools.docs/CDT/Autotools/User_Guide/Invoking-Autotools.html +++ b/build/org.eclipse.cdt.autotools.docs/CDT/Autotools/User_Guide/Invoking-Autotools.html @@ -38,7 +38,7 @@
  1. Invoke Autoconf
      -
    • 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. +
    • 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.
    diff --git a/build/org.eclipse.cdt.autotools.docs/cheatsheets/autotools.xml b/build/org.eclipse.cdt.autotools.docs/cheatsheets/autotools.xml index f7d9c001ec7..d1a1bd8603e 100644 --- a/build/org.eclipse.cdt.autotools.docs/cheatsheets/autotools.xml +++ b/build/org.eclipse.cdt.autotools.docs/cheatsheets/autotools.xml @@ -55,7 +55,7 @@ In the Console view, there is a button entitled "Display Selected Console". 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 ("Configure"), one for build output ("C-Build"), and one for the binary output that you just ran ("<terminated> sources ..."). - + diff --git a/build/org.eclipse.cdt.autotools.docs/tools.xml b/build/org.eclipse.cdt.autotools.docs/tools.xml index dd5b236d6f2..40c2720bbbc 100644 --- a/build/org.eclipse.cdt.autotools.docs/tools.xml +++ b/build/org.eclipse.cdt.autotools.docs/tools.xml @@ -1,8 +1,8 @@ - - + + diff --git a/build/org.eclipse.cdt.autotools.ui/ChangeLog b/build/org.eclipse.cdt.autotools.ui/ChangeLog index 5e62a8d5688..150cecceb89 100644 --- a/build/org.eclipse.cdt.autotools.ui/ChangeLog +++ b/build/org.eclipse.cdt.autotools.ui/ChangeLog @@ -1,3 +1,8 @@ +2012-08-29 Jeff Johnston + + Resolves: bug #388354 + * plugin.properties: Fix statedir option help tip message. + 2012-03-30 Jeff Johnston * src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java diff --git a/build/org.eclipse.cdt.autotools.ui/plugin.properties b/build/org.eclipse.cdt.autotools.ui/plugin.properties index 376356adf49..73ddb900711 100644 --- a/build/org.eclipse.cdt.autotools.ui/plugin.properties +++ b/build/org.eclipse.cdt.autotools.ui/plugin.properties @@ -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) diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java index 5e73d199652..dae5f1d055b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java @@ -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); } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CDTConfigWizardPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CDTConfigWizardPage.java index e6e7c8e7064..a0568bd7a85 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CDTConfigWizardPage.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CDTConfigWizardPage.java @@ -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; } diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java index 713ac819fcd..5eff1e254c4 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java @@ -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 { @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 uniqFiles; public List 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 */ } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 7465d5db67b..506f6a13c0f 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -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 + // 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(); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java index 19bf1599cdf..8be5291ac3f 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java @@ -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()); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/MethodTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/MethodTests.java index 088fc7b816a..e47de9c7eaa 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/MethodTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/MethodTests.java @@ -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()); + } } diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/class.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/class.cpp index 401a5a257d1..6a606e8e3df 100644 --- a/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/class.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/classTests/class.cpp @@ -32,3 +32,6 @@ class D { public: D(D &) {} }; + +class E final : public A { +}; diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp index 9c218bf5bce..06996a5b229 100644 --- a/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp @@ -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(); diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts index 542373ff4c8..bb20b9eae41 100644 --- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts +++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts @@ -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 +{ +}; diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts index 97c1ba19ac8..bb26697b63e 100644 --- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts +++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts @@ -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 + { + } +}; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java index edc38b6d605..7bf24534b46 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java index d9f1542c734..14cb299e7f0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassType.java index 1fc4b2daffa..6001441179a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassType.java @@ -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(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethod.java index 5366f88f47c..6fcca4d4acf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethod.java @@ -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(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/Keywords.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/Keywords.java index 3d8defd5a55..d2097e47c99 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/Keywords.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/Keywords.java @@ -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(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java index a3bc301dad0..da4a20f4cdb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java @@ -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); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java index 5b21be4b3a1..ff98ac89ceb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java index 964f20290da..f979a504796 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java index 25fb6187c7e..cf551dd59ef 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java index 649fdc88797..06c875b746e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java index 58a39f498f8..468edd02551 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java index b5093453da0..aab5db64108 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java index b6a32c6a886..7d88b8900a2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClosureType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClosureType.java index 128614a2610..65df646b9d2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClosureType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClosureType.java @@ -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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java index bf44bc27797..3425de5f07b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java @@ -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(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java index 3ebf67a4377..39ecade0e23 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java @@ -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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java index 611539cf565..06f157e95f9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodInstance.java @@ -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(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java index 988ae58bccd..b14bc0bfdf0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java @@ -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()) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java index e2b57e00cfa..3e0b38f54e0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java index f257ba47630..83ae82cea0f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplateSpecialization.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java index bc070eda26f..6b3fd5c7296 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java index ad24ae0b606..4ee2e403c28 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownConstructor.java index 27c8eb90687..4342c9035cb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownConstructor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownConstructor.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java index de1972896ff..5cc638281ce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java @@ -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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java index ae55002ba98..9d1cf787526 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java index dd5de13f038..e1ddfb49265 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java @@ -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); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java index 37ed8922ed2..a096be9440b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java index c3dde20b6f0..e5abb567a16 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java @@ -160,7 +160,7 @@ public class CIndex implements IIndex { @Override public IIndexName[] findNames(IBinding binding, int flags) throws CoreException { - LinkedList result= new LinkedList(); + ArrayList result= new ArrayList(); 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 encounteredNames = new HashSet(); for (IIndexFragment fragment : fFragments) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java index 4d82579e7bc..1bbe094e1a9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java @@ -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); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java index 9866bac677a..f1472722205 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java @@ -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(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethod.java index 79d262ef835..f134b2ce1fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethod.java @@ -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(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodInstance.java index ca7964b92a8..773beb66108 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodInstance.java @@ -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(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodSpecialization.java index 2f745eac609..3bd9fc85a01 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodSpecialization.java @@ -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(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplate.java index f778d2dc282..bcad67b2211 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplate.java @@ -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(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplateSpecialization.java index e67d4af4f77..4c27406af3e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPMethodTemplateSpecialization.java @@ -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(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateTemplateParameter.java index 9038f519cec..d7b1627364d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateTemplateParameter.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPUnknownClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPUnknownClassType.java index ca5ff930faa..0cb08498daa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPUnknownClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPUnknownClassType.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java index b758058f937..dce5d02d643 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java @@ -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; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java index 94fd4bf1d76..b4e5e9f9032 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java @@ -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$ + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java index 33248fba103..6e5bdc27242 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java @@ -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. */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/messages.properties b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/messages.properties index b342cac1136..e3e7e208ab8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/messages.properties +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/messages.properties @@ -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} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java index 133265932d7..d320edec18a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java index 40dde068aba..21871410093 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java index b9e4969e680..82e2b9f87ce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java @@ -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)); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index 1ebf474b9ba..c62e295109f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -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) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java index 67d65e7672b..e64d8f92751 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java @@ -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 { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java index 7360c7a1ff5..697fcfdeab4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -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); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java index 4fb803f0ba4..a54785dbb7b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java @@ -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(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java index 1de4f84d7e5..3262f7a77c3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java index fc246b59470..894c6f9e3fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java index ba697af9949..c8ced8f22d4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java index db0a22f3fba..5d011795f8a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java @@ -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(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java index b6e68938324..5fc6fbb3b07 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java @@ -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; + } } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java index 44e6bdd1c31..91de1214d5e 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/UNCPathConverter.java @@ -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; + } } /** diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java index 495f486432b..0d0aae02fb1 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java @@ -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$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java index d9148c3f94b..6ca570e5744 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java @@ -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 front = new LinkedList(); + ArrayDeque front = new ArrayDeque(); front.add(headerFile); HashSet processed = new HashSet(); processed.add(headerFile); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ConstructedCEditorMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ConstructedCEditorMessages.properties index 5a0345ca611..d020935426b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ConstructedCEditorMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ConstructedCEditorMessages.properties @@ -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 diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java index 9349f67ce3f..61270ae07d4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java @@ -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 diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java index 5c90343ef9f..5daf89d8597 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java @@ -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) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java new file mode 100644 index 00000000000..3b571eeb2f9 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java @@ -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; + } + +} diff --git a/debug/org.eclipse.cdt.gdb.ui/plugin.xml b/debug/org.eclipse.cdt.gdb.ui/plugin.xml index 95d3dfa6762..4775cdfbf57 100644 --- a/debug/org.eclipse.cdt.gdb.ui/plugin.xml +++ b/debug/org.eclipse.cdt.gdb.ui/plugin.xml @@ -3,7 +3,7 @@ ../../pom.xml - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui eclipse-plugin diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java index a094d71579e..cad09f061b3 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java @@ -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() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties similarity index 96% rename from dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/messages.properties rename to dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties index 80af558c977..96c244d3df5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/messages.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties @@ -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 diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java index f899c0c487b..a35c0913306 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java @@ -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); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java index d7b0714f36b..e4b54b11dc9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepoints/TraceControlView.java @@ -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(); }