summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Weinstein2013-04-04 15:03:25 (EDT)
committer Sergey Prigogin2013-04-04 18:16:25 (EDT)
commit1f8ea23acb209ef599d6b58802deb88c5897b66e (patch)
treed23daf5c1ed86297835556114cc295db6fa89396
parent28ae178c70d08ca2f19d83837bf4e5d0f035c185 (diff)
downloadorg.eclipse.cdt-1f8ea23acb209ef599d6b58802deb88c5897b66e.zip
org.eclipse.cdt-1f8ea23acb209ef599d6b58802deb88c5897b66e.tar.gz
org.eclipse.cdt-1f8ea23acb209ef599d6b58802deb88c5897b66e.tar.bz2
Bug 295674 - Friend functions are *not* methods.refs/changes/62/11662/2
Change-Id: Iad77cedd5c28044d68c66348526ac3213c24f52a Reviewed-on: https://git.eclipse.org/r/11662 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rwxr-xr-x[-rw-r--r--]core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NodeHelper.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NodeHelper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NodeHelper.java
index 2e8d2f9..51b79dc 100644..100755
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NodeHelper.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NodeHelper.java
@@ -16,7 +16,9 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
@@ -25,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
@@ -128,8 +131,13 @@ public class NodeHelper {
if (simpleDeclaration == null) {
return false;
}
- return simpleDeclaration.getDeclarators().length == 1 &&
- simpleDeclaration.getDeclarators()[0] instanceof ICPPASTFunctionDeclarator;
+ final IASTDeclSpecifier declSpecifier = simpleDeclaration.getDeclSpecifier();
+ final IASTDeclarator[] declarators = simpleDeclaration.getDeclarators();
+ if ((declSpecifier instanceof ICPPASTDeclSpecifier)
+ && ((ICPPASTDeclSpecifier) declSpecifier).isFriend()) {
+ return false;
+ }
+ return declarators.length == 1 && declarators[0] instanceof ICPPASTFunctionDeclarator;
}
public static boolean isContainedInTemplateDeclaration(IASTNode node) {