diff options
author | Thomas Corbat | 2012-08-29 04:36:11 +0000 |
---|---|---|
committer | Sergey Prigogin | 2012-08-29 04:36:11 +0000 |
commit | 6d4c1e4dffcdc14c1b9db7420f6682f779022705 (patch) | |
tree | 0f4b6c49c3d7f5510f6ed93f251421a3fc21db16 /core/org.eclipse.cdt.core | |
parent | cce375dd68e7ae9288d141d018fe529ed740cb2a (diff) | |
download | org.eclipse.cdt-6d4c1e4dffcdc14c1b9db7420f6682f779022705.tar.gz org.eclipse.cdt-6d4c1e4dffcdc14c1b9db7420f6682f779022705.tar.xz org.eclipse.cdt-6d4c1e4dffcdc14c1b9db7420f6682f779022705.zip |
Bug 380623 - [C++11] Explicit Virtual Overrides
Diffstat (limited to 'core/org.eclipse.cdt.core')
44 files changed, 715 insertions, 166 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters index 736390c6a2b..d0bd80cfa84 100644 --- a/core/org.eclipse.cdt.core/.settings/.api_filters +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -99,4 +99,16 @@ </message_arguments> </filter> </resource> + <resource path="parser/org/eclipse/cdt/core/parser/Keywords.java" type="org.eclipse.cdt.core.parser.Keywords"> + <filter id="1143996420"> + <message_arguments> + <message_argument value="cFINAL"/> + </message_arguments> + </filter> + <filter id="1143996420"> + <message_arguments> + <message_argument value="cOVERRIDE"/> + </message_arguments> + </filter> + </resource> </component> 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..27c19b5723f 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,16 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie */ @Override public ICPPASTCompositeTypeSpecifier copy(CopyStyle style); + + /** + * Queries whether the type is final. + * @noreference This method is not intended to be referenced by clients. + */ + public boolean isFinal(); + + /** + * Sets whether the type is final. + * @noreference This method is not intended to be referenced by clients. + */ + 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 4a6c53e839f..19659f8bd3f 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; @@ -162,4 +163,28 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato */ @Override public ICPPASTFunctionDeclarator copy(CopyStyle style); + + /** + * Returns whether this function is declared override. + * @noreference This method is not intended to be referenced by clients. + */ + public boolean isOverride(); + + /** + * Sets whether this function is declared override. + * @noreference This method is not intended to be referenced by clients. + */ + public void setOverride(boolean isOverride); + + /** + * Returns whether this function is declared final. + * @noreference This method is not intended to be referenced by clients. + */ + public boolean isFinal(); + + /** + * Sets whether this function is declared final. + * @noreference This method is not intended to be referenced by clients. + */ + 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..70be18ace83 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,16 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember { * @since 5.1 */ public boolean isPureVirtual(); + + /** + * Returns whether this method is declared override. + * @noreference This method is not intended to be referenced by clients. + */ + public boolean isOverride(); + + /** + * Returns whether this method is declared final. + * @noreference This method is not intended to be referenced by clients. + */ + 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..5832d9e537e 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,7 @@ public class Keywords { public static final char[] cFALSE = "false".toCharArray(); public static final char[] cFLOAT = "float".toCharArray(); public static final char[] cFOR = "for".toCharArray(); + 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 +187,7 @@ 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(); + 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/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/CPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java index acdd8d9fede..b07eb82dbbd 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; @@ -54,6 +55,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; @@ -78,6 +81,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)); @@ -306,4 +311,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 7c5327c5491..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; @@ -124,6 +125,16 @@ public class CPPClassSpecialization extends CPPSpecialization public ICPPFunctionType getType() { return new ProblemFunctionType(getID()); } + + @Override + public boolean isOverride() { + return false; + } + + @Override + public boolean isFinal() { + return false; + } } private ICPPClassSpecializationScope specScope; @@ -422,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; @@ -188,6 +189,16 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod } @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; @@ -106,6 +107,16 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization implement } @Override + public boolean isOverride() { + return false; + } + + @Override + public boolean isFinal() { + return false; + } + + @Override public IType[] getExceptionSpecification(IASTNode point) { if (isImplicit()) { return ClassTypeHelper.getInheritedExceptionSpecification(this, point); 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() { + 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) { - 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(); - } + 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 false; + 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 2c0e8bcf8cc..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,12 +1,13 @@ /******************************************************************************* - * 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * 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 0f2834e1c75..6c3d9216050 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/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 c5e1c1c7640..3839dcee207 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; @@ -141,6 +142,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/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/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 35b992c3f59..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,6 +73,7 @@ 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) { @@ -78,6 +81,15 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } @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; } @@ -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; @@ -232,6 +240,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) { return type.isSameType(this); 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; @@ -212,6 +213,11 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization } @Override + public boolean isFinal() { + return getClassTemplate().isFinal(); + } + + @Override public ICPPTemplateArgument[] getTemplateArguments() { try { final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); 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; @@ -340,6 +341,11 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding } @Override + public boolean isFinal() { + return false; + } + + @Override public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) { int pos = param.getParameterPosition(); ICPPTemplateParameter[] pars = getTemplateParameters(); 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; + } } |