summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodTemplate.java61
1 files changed, 46 insertions, 15 deletions
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 e2b57e0..3e0b38f 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;
}
}