From 5a9b69c9ee76c51b737bb967f8d89cd4e7ae7493 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 6 Oct 2008 09:22:25 +0000 Subject: [PATCH] Adds ICPPMethod.isPureVirtual(), bug 248865. --- .../index/tests/IndexUpdateTests.java | 11 ++++++-- .../cdt/internal/pdom/tests/MethodTests.java | 6 +++-- .../cdt/core/dom/ast/cpp/ICPPMethod.java | 12 +++++++-- .../dom/parser/cpp/CPPImplicitMethod.java | 5 ++++ .../core/dom/parser/cpp/CPPMethod.java | 26 +++++++++++++++++++ .../dom/parser/cpp/CPPMethodInstance.java | 7 +++++ .../parser/cpp/CPPMethodSpecialization.java | 8 ++++++ .../dom/parser/cpp/CPPMethodTemplate.java | 4 +++ .../cpp/CPPMethodTemplateSpecialization.java | 4 +++ .../composite/cpp/CompositeCPPMethod.java | 4 +++ .../cpp/CompositeCPPMethodInstance.java | 8 ++++-- .../cpp/CompositeCPPMethodSpecialization.java | 8 ++++-- .../cpp/CompositeCPPMethodTemplate.java | 8 ++++-- ...positeCPPMethodTemplateSpecialization.java | 8 ++++-- .../eclipse/cdt/internal/core/pdom/PDOM.java | 1 + .../core/pdom/dom/cpp/PDOMCPPAnnotation.java | 7 ++--- .../core/pdom/dom/cpp/PDOMCPPMethod.java | 5 +++- .../pdom/dom/cpp/PDOMCPPMethodInstance.java | 9 ++++--- .../dom/cpp/PDOMCPPMethodSpecialization.java | 4 +++ .../pdom/dom/cpp/PDOMCPPMethodTemplate.java | 6 ++++- .../PDOMCPPMethodTemplateSpecialization.java | 4 +++ 21 files changed, 133 insertions(+), 22 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java index 1366f5afb03..fe78b1db04b 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.index.tests; import java.util.Arrays; @@ -49,6 +48,7 @@ public class IndexUpdateTests extends IndexTestBase { private static final String EXPLICIT = "explicit"; private static final String VIRTUAL = "virtual"; + private static final String PURE_VIRTUAL= "pure-virtual"; private static final String PROTECTED = "protected"; private static final String PUBLIC = "public"; private static final String PRIVATE = "private"; @@ -80,6 +80,7 @@ public class IndexUpdateTests extends IndexTestBase { super(name); } + @Override public void setUp() throws Exception { super.setUp(); if (fCppProject == null) { @@ -119,6 +120,7 @@ public class IndexUpdateTests extends IndexTestBase { TestSourceReader.waitUntilFileIsIndexed(fIndex, fFile, INDEXER_WAIT_TIME); } + @Override public void tearDown() throws Exception { fIndex= null; if (fFile != null) { @@ -375,9 +377,11 @@ public class IndexUpdateTests extends IndexTestBase { // class MyClass {private: int method(char a);}; // class MyClass {int method(char a){};}; + + // class MyClass {virtual int method(char a) = 0;}; public void testCppMethod() throws Exception { - setupFile(9, true); + setupFile(10, true); checkCppMethod("MyClass::method", new String[] {INT, INT, INT}, new String[]{PRIVATE}); updateFile(); checkCppMethod("MyClass::method", new String[] {SHORT, INT, INT}, new String[]{PRIVATE}); @@ -395,6 +399,8 @@ public class IndexUpdateTests extends IndexTestBase { checkCppMethod("MyClass::method", new String[] {INT, CHAR}, new String[]{PRIVATE}); updateFile(); checkCppMethod("MyClass::method", new String[] {INT, CHAR}, new String[]{PRIVATE, INLINE}); + updateFile(); + checkCppMethod("MyClass::method", new String[] {INT, CHAR}, new String[]{PRIVATE, VIRTUAL, PURE_VIRTUAL}); } // class MyClass {protected: int method(int a, int b);}; @@ -429,6 +435,7 @@ public class IndexUpdateTests extends IndexTestBase { checkFunction(method, types, modifiers); checkCppMember(method, modifiers); checkModifier(modifiers, VIRTUAL, method.isVirtual()); + checkModifier(modifiers, PURE_VIRTUAL, method.isPureVirtual()); checkModifier(modifiers, IMPLICIT, method.isImplicit()); } 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 0984f73af94..0d7f83ea18d 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation. + * Copyright (c) 2006, 2008 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,7 +8,6 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.pdom.tests; import junit.framework.Test; @@ -38,12 +37,14 @@ public class MethodTests extends PDOMTestBase { return suite(MethodTests.class); } + @Override protected void setUp() throws Exception { project = createProject("methodTests"); pdom = (PDOM) CCoreInternals.getPDOMManager().getPDOM(project); pdom.acquireReadLock(); } + @Override protected void tearDown() throws Exception { pdom.releaseReadLock(); if (project != null) { @@ -109,6 +110,7 @@ public class MethodTests extends PDOMTestBase { assertEquals(1, bindings.length); ICPPMethod method = (ICPPMethod) bindings[0]; assertTrue(method.isVirtual()); + assertTrue(method.isPureVirtual()); } public void testPureVirtualMethodType() throws Exception { 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 563ae6f1300..4d55684d500 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 @@ -6,14 +6,16 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM - Initial API and implementation + * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast.cpp; import org.eclipse.cdt.core.dom.ast.DOMException; /** - * @author Doug Schaefer + * Base interface for methods, also used for constructors. + * + * @noimplement This interface is not intended to be implemented by clients. */ public interface ICPPMethod extends ICPPFunction, ICPPMember { public static final ICPPMethod [] EMPTY_CPPMETHOD_ARRAY = new ICPPMethod[0]; @@ -36,4 +38,10 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember { * @since 4.0 */ public boolean isImplicit(); + + /** + * Returns whether this is a pure abstract method + * @since 5.1 + */ + public boolean isPureVirtual() throws DOMException; } 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 82e47c76b3d..c95f307a462 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 @@ -171,8 +171,13 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod return true; } + public boolean isPureVirtual() { + 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 a6ca9dc6367..69e66f67a75 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 @@ -60,6 +60,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { public boolean isVirtual() throws DOMException { throw new DOMException( this ); } + public boolean isPureVirtual() throws DOMException { + throw new DOMException( this ); + } /* (non-Javadoc) * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor() @@ -239,4 +242,27 @@ public class CPPMethod extends CPPFunction implements ICPPMethod { public boolean isImplicit() { return false; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() + */ + public boolean isPureVirtual() throws DOMException { + if (declarations != null) { + for (IASTDeclarator dtor : declarations) { + if (dtor == null) + break; + + dtor = CPPVisitor.findOutermostDeclarator(dtor); + IASTDeclaration decl = (IASTDeclaration) dtor.getParent(); + if (decl.getParent() instanceof ICPPASTCompositeTypeSpecifier) { + dtor= CPPVisitor.findTypeRelevantDeclarator(dtor); + if (dtor instanceof ICPPASTFunctionDeclarator) { + return ((ICPPASTFunctionDeclarator) dtor).isPureVirtual(); + } + } + } + } + return false; + } + } 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 da5bdce68fe..1f761e9961e 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 @@ -44,6 +44,13 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod return ((ICPPMethod)getTemplateDefinition()).isVirtual(); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() + */ + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)getTemplateDefinition()).isPureVirtual(); + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor() */ 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 1bbb1f05fcb..9373ceeebb8 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 @@ -79,4 +79,12 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization return false; } + public boolean isPureVirtual() throws DOMException { + ICPPMethod f = (ICPPMethod) getSpecializedBinding(); + if (f != null) + return f.isPureVirtual(); + + return false; + } + } 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 41cd57db3c6..75e3daf9016 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 @@ -156,4 +156,8 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements return false; } + public boolean isPureVirtual() throws DOMException { + return false; + } + } 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 ded911a6576..c1b51af9e6f 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 @@ -57,4 +57,8 @@ public class CPPMethodTemplateSpecialization extends return false; } + public boolean isPureVirtual() throws DOMException { + return false; + } + } 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 a8bf72c2ab8..46500fc298a 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 @@ -43,4 +43,8 @@ class CompositeCPPMethod extends CompositeCPPFunction implements ICPPMethod { public int getVisibility() throws DOMException { return ((ICPPMethod)rbinding).getVisibility(); } + + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)rbinding).isPureVirtual(); + } } 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 ea1205beb08..11dfd2c74a6 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,12 @@ /******************************************************************************* - * Copyright (c) 2007 Symbian Software Systems and others. + * Copyright (c) 2007, 2008 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 *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; @@ -42,4 +42,8 @@ public class CompositeCPPMethodInstance extends CompositeCPPFunctionInstance imp public int getVisibility() throws DOMException { return ((ICPPMethod)rbinding).getVisibility(); } + + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)rbinding).isPureVirtual(); + } } 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 a9784b7a4bd..af7d00987cf 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,12 @@ /******************************************************************************* - * Copyright (c) 2007 Symbian Software Systems and others. + * Copyright (c) 2007, 2008 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 *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; @@ -43,4 +43,8 @@ implements ICPPMethod { public int getVisibility() throws DOMException { return ((ICPPMethod)rbinding).getVisibility(); } + + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)rbinding).isPureVirtual(); + } } 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 4deba0ba000..17cd4b8fea2 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,12 @@ /******************************************************************************* - * Copyright (c) 2007 Symbian Software Systems and others. + * Copyright (c) 2007, 2008 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 *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; @@ -44,4 +44,8 @@ public class CompositeCPPMethodTemplate extends CompositeCPPFunctionTemplate imp return ((ICPPMethod)rbinding).getVisibility(); } + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)rbinding).isPureVirtual(); + } + } 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 22b6e3cc530..34d37b3441a 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,12 @@ /******************************************************************************* - * Copyright (c) 2007 Symbian Software Systems and others. + * Copyright (c) 2007, 2008 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 *******************************************************************************/ package org.eclipse.cdt.internal.core.index.composite.cpp; @@ -46,4 +46,8 @@ public class CompositeCPPMethodTemplateSpecialization public int getVisibility() throws DOMException { return ((ICPPMethod)rbinding).getVisibility(); } + + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)rbinding).isPureVirtual(); + } } 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 c3e9511d08a..780aa4bc77e 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 @@ -179,6 +179,7 @@ public class PDOM extends PlatformObject implements IPDOM { * 70.0 - cleaned up templates, fixes bug 236197 * 71.0 - proper support for anonymous unions, bug 206450 * 72.0 - store project-relative paths for resources that belong to the project, bug 239472 + * 72.1 - store flag for pure virtual methods. */ public static final int LINKAGES = Database.DATA_AREA; 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 08c5a3beb08..64668dc6e71 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, 2007 IBM Corporation. + * Copyright (c) 2006, 2008 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 @@ -9,7 +9,6 @@ * IBM Corporation - initial API and implementation * Markus Schorn (Wind River Systems) *******************************************************************************/ - package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.dom.ast.DOMException; @@ -39,7 +38,8 @@ class PDOMCPPAnnotation { public static final int DESTRUCTOR_OFFSET = 1; public static final int IMPLICIT_METHOD_OFFSET = 2; public static final int EXPLICIT_CONSTRUCTOR_OFFSET = 3; - public static final int MAX_EXTRA_OFFSET= EXPLICIT_CONSTRUCTOR_OFFSET; + public static final int PURE_VIRTUAL_OFFSET = 4; + public static final int MAX_EXTRA_OFFSET= PURE_VIRTUAL_OFFSET; /** * Encodes storage class specifiers and other annotation, including @@ -92,6 +92,7 @@ class PDOMCPPAnnotation { modifiers |= (method.isVirtual() ? 1 : 0) << VIRTUAL_OFFSET; modifiers |= (method.isDestructor() ? 1 : 0) << DESTRUCTOR_OFFSET; modifiers |= (method.isImplicit() ? 1 : 0) << IMPLICIT_METHOD_OFFSET; + modifiers |= (method.isPureVirtual() ? 1 : 0) << PURE_VIRTUAL_OFFSET; } if (binding instanceof ICPPConstructor) { ICPPConstructor constructor= (ICPPConstructor) binding; 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 a3931078015..c8dd55afb83 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 @@ -11,7 +11,6 @@ * Andrew Ferguson (Symbian) * Markus Schorn (Wind River Systems) *******************************************************************************/ - package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.dom.ast.DOMException; @@ -104,6 +103,10 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.VIRTUAL_OFFSET); } + public boolean isPureVirtual() throws DOMException { + return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.PURE_VIRTUAL_OFFSET); + } + public boolean isDestructor() throws DOMException { return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.DESTRUCTOR_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 88907c1234d..eaf6af5b1dd 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,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 QNX Software Systems and others. + * Copyright (c) 2007, 2008 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 @@ -24,8 +24,7 @@ import org.eclipse.core.runtime.CoreException; * @author Bryan Wilkinson * */ -class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements - ICPPMethod { +class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMethod { /** * The size in bytes of a PDOMCPPMethodInstance record in the database. @@ -69,6 +68,10 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements return ((ICPPMethod)getTemplateDefinition()).isVirtual(); } + public boolean isPureVirtual() throws DOMException { + return ((ICPPMethod)getTemplateDefinition()).isPureVirtual(); + } + public ICPPClassType getClassOwner() throws DOMException { return (ICPPClassType) getOwner(); } 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 49fcf6ffb3a..8062aef4852 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 @@ -89,6 +89,10 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.VIRTUAL_OFFSET); } + public boolean isPureVirtual() throws DOMException { + return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.PURE_VIRTUAL_OFFSET); + } + @Override public boolean isExtern() throws DOMException { // ISO/IEC 14882:2003 9.2.6 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 7d54c15137c..823dbe5d29c 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,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 QNX Software Systems and others. + * Copyright (c) 2007, 2008 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 @@ -128,4 +128,8 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho // ISO/IEC 14882:2003 9.2.6 return false; } + + public boolean isPureVirtual() throws DOMException { + 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 78f9dd11b34..8e6fbb8bf2c 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 @@ -83,4 +83,8 @@ class PDOMCPPMethodTemplateSpecialization extends public boolean isExternC() { return false; } + + public boolean isPureVirtual() throws DOMException { + return false; + } }