mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 438384 - "syntax error" for class method ref qualifiers
This commit is contained in:
parent
33b70bb10c
commit
1eabfa5241
17 changed files with 187 additions and 83 deletions
|
@ -2242,6 +2242,31 @@ public class AST2CPPSpecTest extends AST2SpecTestBase {
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//class A {
|
||||||
|
// void a() & {}
|
||||||
|
// void b() && {}
|
||||||
|
//
|
||||||
|
// void c() const& {}
|
||||||
|
// void d() const&& {}
|
||||||
|
//
|
||||||
|
// void e() volatile & {}
|
||||||
|
// void f() volatile && {}
|
||||||
|
//
|
||||||
|
// void g() volatile const& {}
|
||||||
|
// void h() volatile const&& {}
|
||||||
|
//};
|
||||||
|
public void test8s4() throws Exception {
|
||||||
|
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// void print(int a, int)
|
||||||
|
// {
|
||||||
|
// //printf("a = %d",a);
|
||||||
|
// }
|
||||||
|
public void test8_4s5() throws Exception {
|
||||||
|
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// int a;
|
// int a;
|
||||||
// struct X {
|
// struct X {
|
||||||
// static int a;
|
// static int a;
|
||||||
|
@ -5717,7 +5742,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase {
|
||||||
|
|
||||||
// template <class T> int f(T[5]);
|
// template <class T> int f(T[5]);
|
||||||
// int I = f<int>(0);
|
// int I = f<int>(0);
|
||||||
// int j = f<void>(0); // invalid array // also no error with gcc
|
// int j = f<void>(0); // invalid array
|
||||||
public void _test14_8_2s8b() throws Exception {
|
public void _test14_8_2s8b() throws Exception {
|
||||||
final String content= getAboveComment();
|
final String content= getAboveComment();
|
||||||
BindingAssertionHelper bh= new BindingAssertionHelper(content, true);
|
BindingAssertionHelper bh= new BindingAssertionHelper(content, true);
|
||||||
|
@ -6593,14 +6618,6 @@ public class AST2CPPSpecTest extends AST2SpecTestBase {
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, false, 0);
|
parse(getAboveComment(), ParserLanguage.CPP, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void print(int a, int)
|
|
||||||
// {
|
|
||||||
// //printf("a = %d",a);
|
|
||||||
// }
|
|
||||||
public void test8_4s5() throws Exception {
|
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// int a;
|
// int a;
|
||||||
// const int b = a;
|
// const int b = a;
|
||||||
// int c = b;
|
// int c = b;
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
|
||||||
Bundle-Version: 5.8.0.qualifier
|
Bundle-Version: 5.9.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
|
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -59,6 +59,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDecltypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator.RefQualifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPackExpansionExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPackExpansionExpression;
|
||||||
|
@ -314,6 +315,17 @@ public class ASTStringUtil {
|
||||||
if (cppFunctionDecl.isVolatile()) {
|
if (cppFunctionDecl.isVolatile()) {
|
||||||
buffer.append(Keywords.VOLATILE).append(' ');
|
buffer.append(Keywords.VOLATILE).append(' ');
|
||||||
}
|
}
|
||||||
|
RefQualifier refQualifier = cppFunctionDecl.getRefQualifier();
|
||||||
|
if (refQualifier != null) {
|
||||||
|
switch (refQualifier) {
|
||||||
|
case LVALUE:
|
||||||
|
buffer.append(Keywords.cpAMPER).append(' ');
|
||||||
|
break;
|
||||||
|
case RVALUE:
|
||||||
|
buffer.append(Keywords.cpAND).append(' ');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cppFunctionDecl.isPureVirtual()) {
|
if (cppFunctionDecl.isPureVirtual()) {
|
||||||
buffer.append("=0 "); //$NON-NLS-1$
|
buffer.append("=0 "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,6 +398,9 @@ public class ASTTypeUtil {
|
||||||
if (type instanceof ICPPFunctionType) {
|
if (type instanceof ICPPFunctionType) {
|
||||||
ICPPFunctionType ft= (ICPPFunctionType) type;
|
ICPPFunctionType ft= (ICPPFunctionType) type;
|
||||||
needSpace= appendCVQ(result, needSpace, ft.isConst(), ft.isVolatile(), false);
|
needSpace= appendCVQ(result, needSpace, ft.isConst(), ft.isVolatile(), false);
|
||||||
|
if (ft.hasRefQualifier()) {
|
||||||
|
appendRefQualifier(result, needSpace, ft.isRValueReference()); needSpace = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (type instanceof IPointerType) {
|
} else if (type instanceof IPointerType) {
|
||||||
if (type instanceof ICPPPointerToMemberType) {
|
if (type instanceof ICPPPointerToMemberType) {
|
||||||
|
@ -466,6 +469,14 @@ public class ASTTypeUtil {
|
||||||
return needSpace;
|
return needSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void appendRefQualifier(StringBuilder target, boolean needSpace,
|
||||||
|
boolean isRValueReference) {
|
||||||
|
if (needSpace) {
|
||||||
|
target.append(SPACE);
|
||||||
|
}
|
||||||
|
target.append(isRValueReference ? Keywords.cpAND : Keywords.cpAMPER);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the normalized string representation of the type.
|
* Returns the normalized string representation of the type.
|
||||||
* @see #getType(IType, boolean)
|
* @see #getType(IType, boolean)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
* Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -26,6 +26,11 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarator, ICPPASTDeclarator {
|
public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarator, ICPPASTDeclarator {
|
||||||
|
/**
|
||||||
|
* @since 5.9
|
||||||
|
*/
|
||||||
|
public enum RefQualifier { LVALUE, RVALUE }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used as return value for {@link #getExceptionSpecification()}.
|
* Used as return value for {@link #getExceptionSpecification()}.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
@ -99,6 +104,18 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
|
||||||
*/
|
*/
|
||||||
public void setPureVirtual(boolean isPureVirtual);
|
public void setPureVirtual(boolean isPureVirtual);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ref-qualifier.
|
||||||
|
* @since 5.9
|
||||||
|
*/
|
||||||
|
public RefQualifier getRefQualifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ref-qualifier.
|
||||||
|
* @since 5.9
|
||||||
|
*/
|
||||||
|
public void setRefQualifier(RefQualifier value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005-2009 IBM Corporation and others.
|
* Copyright (c) 2005, 2014 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -30,6 +30,18 @@ public interface ICPPFunctionType extends IFunctionType {
|
||||||
*/
|
*/
|
||||||
public boolean isVolatile();
|
public boolean isVolatile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} for a method declared with a ref-qualifier.
|
||||||
|
* @since 5.9
|
||||||
|
*/
|
||||||
|
public boolean hasRefQualifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if the type of the implicit object parameter is an rvalue reference.
|
||||||
|
* @since 5.9
|
||||||
|
*/
|
||||||
|
public boolean isRValueReference();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the function type takes variable number of arguments.
|
* Whether the function type takes variable number of arguments.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
* Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -44,6 +44,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private boolean isConst;
|
private boolean isConst;
|
||||||
private boolean isMutable;
|
private boolean isMutable;
|
||||||
|
private RefQualifier refQualifier;
|
||||||
|
|
||||||
private ICPPFunctionScope scope;
|
private ICPPFunctionScope scope;
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
||||||
copy.isVolatile = isVolatile;
|
copy.isVolatile = isVolatile;
|
||||||
copy.isConst = isConst;
|
copy.isConst = isConst;
|
||||||
copy.isMutable = isMutable;
|
copy.isMutable = isMutable;
|
||||||
|
copy.refQualifier = refQualifier;
|
||||||
|
|
||||||
for (IASTParameterDeclaration param : getParameters()) {
|
for (IASTParameterDeclaration param : getParameters()) {
|
||||||
copy.addParameterDeclaration(param == null ? null : param.copy(style));
|
copy.addParameterDeclaration(param == null ? null : param.copy(style));
|
||||||
|
@ -213,6 +215,17 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public RefQualifier getRefQualifier() {
|
||||||
|
return refQualifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRefQualifier(RefQualifier value) {
|
||||||
|
assertNotFrozen();
|
||||||
|
refQualifier = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
public org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
||||||
if (ASTQueries.findTypeRelevantDeclarator(this) == this) {
|
if (ASTQueries.findTypeRelevantDeclarator(this) == this) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2010, 2014 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -102,7 +102,7 @@ public class CPPClosureType extends PlatformObject implements ICPPClassType, ICP
|
||||||
// Function call operator
|
// Function call operator
|
||||||
final IType returnType= getReturnType();
|
final IType returnType= getReturnType();
|
||||||
final IType[] parameterTypes= getParameterTypes();
|
final IType[] parameterTypes= getParameterTypes();
|
||||||
ft= new CPPFunctionType(returnType, parameterTypes, !isMutable(), false, false);
|
ft= new CPPFunctionType(returnType, parameterTypes, !isMutable(), false, false, false, false);
|
||||||
|
|
||||||
ICPPParameter[] params = new ICPPParameter[parameterTypes.length];
|
ICPPParameter[] params = new ICPPParameter[parameterTypes.length];
|
||||||
for (int i = 0; i < params.length; i++) {
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
@ -117,7 +117,7 @@ public class CPPClosureType extends PlatformObject implements ICPPClassType, ICP
|
||||||
// Conversion operator
|
// Conversion operator
|
||||||
if (needConversionOperator) {
|
if (needConversionOperator) {
|
||||||
final CPPFunctionType conversionTarget = new CPPFunctionType(returnType, parameterTypes);
|
final CPPFunctionType conversionTarget = new CPPFunctionType(returnType, parameterTypes);
|
||||||
ft= new CPPFunctionType(conversionTarget, IType.EMPTY_TYPE_ARRAY, true, false, false);
|
ft= new CPPFunctionType(conversionTarget, IType.EMPTY_TYPE_ARRAY, true, false, false, false, false);
|
||||||
m= new CPPImplicitMethod(scope, CPPASTConversionName.createName(conversionTarget, null), ft, params);
|
m= new CPPImplicitMethod(scope, CPPASTConversionName.createName(conversionTarget, null), ft, params);
|
||||||
result[5]= m;
|
result[5]= m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
* Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -31,18 +31,22 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
private final IType returnType;
|
private final IType returnType;
|
||||||
private final boolean isConst;
|
private final boolean isConst;
|
||||||
private final boolean isVolatile;
|
private final boolean isVolatile;
|
||||||
|
private final boolean hasRefQualifier;
|
||||||
|
private final boolean isRValueReference;
|
||||||
private final boolean takesVarargs;
|
private final boolean takesVarargs;
|
||||||
|
|
||||||
public CPPFunctionType(IType returnType, IType[] types) {
|
public CPPFunctionType(IType returnType, IType[] types) {
|
||||||
this(returnType, types, false, false, false);
|
this(returnType, types, false, false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPFunctionType(IType returnType, IType[] types, boolean isConst, boolean isVolatile,
|
public CPPFunctionType(IType returnType, IType[] types, boolean isConst, boolean isVolatile,
|
||||||
boolean takesVarargs) {
|
boolean hasRefQualifier, boolean isRValueReference, boolean takesVarargs) {
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
this.parameters = types;
|
this.parameters = types;
|
||||||
this.isConst = isConst;
|
this.isConst = isConst;
|
||||||
this.isVolatile= isVolatile;
|
this.isVolatile= isVolatile;
|
||||||
|
this.hasRefQualifier = hasRefQualifier;
|
||||||
|
this.isRValueReference = isRValueReference;
|
||||||
this.takesVarargs= takesVarargs;
|
this.takesVarargs= takesVarargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +56,10 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
return o.isSameType(this);
|
return o.isSameType(this);
|
||||||
if (o instanceof ICPPFunctionType) {
|
if (o instanceof ICPPFunctionType) {
|
||||||
ICPPFunctionType ft = (ICPPFunctionType) o;
|
ICPPFunctionType ft = (ICPPFunctionType) o;
|
||||||
if (isConst() != ft.isConst() || isVolatile() != ft.isVolatile() || takesVarArgs() != ft.takesVarArgs()) {
|
if (isConst() != ft.isConst() || isVolatile() != ft.isVolatile()
|
||||||
|
|| hasRefQualifier() != ft.hasRefQualifier()
|
||||||
|
|| isRValueReference() != ft.isRValueReference()
|
||||||
|
|| takesVarArgs() != ft.takesVarArgs()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +69,7 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
if ((returnType == null) ^ (ft.getReturnType() == null))
|
if ((returnType == null) ^ (ft.getReturnType() == null))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (returnType != null && ! returnType.isSameType(ft.getReturnType()))
|
if (returnType != null && !returnType.isSameType(ft.getReturnType()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (parameters.length == fps.length) {
|
if (parameters.length == fps.length) {
|
||||||
|
@ -72,7 +79,7 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!SemanticUtil.isEmptyParameterList(parameters)
|
if (!SemanticUtil.isEmptyParameterList(parameters)
|
||||||
|| !SemanticUtil.isEmptyParameterList(fps)) {
|
|| !SemanticUtil.isEmptyParameterList(fps)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +125,16 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
return isVolatile;
|
return isVolatile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasRefQualifier() {
|
||||||
|
return hasRefQualifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRValueReference() {
|
||||||
|
return isRValueReference;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean takesVarArgs() {
|
public boolean takesVarArgs() {
|
||||||
return takesVarargs;
|
return takesVarargs;
|
||||||
|
@ -131,9 +148,11 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
@Override
|
@Override
|
||||||
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
|
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
short firstBytes= ITypeMarshalBuffer.FUNCTION_TYPE;
|
short firstBytes= ITypeMarshalBuffer.FUNCTION_TYPE;
|
||||||
if (isConst()) firstBytes |= ITypeMarshalBuffer.FLAG1;
|
if (isConst) firstBytes |= ITypeMarshalBuffer.FLAG1;
|
||||||
if (takesVarArgs()) firstBytes |= ITypeMarshalBuffer.FLAG2;
|
if (takesVarargs) firstBytes |= ITypeMarshalBuffer.FLAG2;
|
||||||
if (isVolatile()) firstBytes |= ITypeMarshalBuffer.FLAG3;
|
if (isVolatile) firstBytes |= ITypeMarshalBuffer.FLAG3;
|
||||||
|
if (hasRefQualifier) firstBytes |= ITypeMarshalBuffer.FLAG4;
|
||||||
|
if (isRValueReference) firstBytes |= ITypeMarshalBuffer.FLAG5;
|
||||||
|
|
||||||
buffer.putShort(firstBytes);
|
buffer.putShort(firstBytes);
|
||||||
buffer.putInt(parameters.length);
|
buffer.putInt(parameters.length);
|
||||||
|
@ -154,6 +173,8 @@ public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
|
||||||
return new CPPFunctionType(rt, pars,
|
return new CPPFunctionType(rt, pars,
|
||||||
(firstBytes & ITypeMarshalBuffer.FLAG1) != 0, // const
|
(firstBytes & ITypeMarshalBuffer.FLAG1) != 0, // const
|
||||||
(firstBytes & ITypeMarshalBuffer.FLAG3) != 0, // volatile
|
(firstBytes & ITypeMarshalBuffer.FLAG3) != 0, // volatile
|
||||||
|
(firstBytes & ITypeMarshalBuffer.FLAG5) != 0, // has ref-qualifier
|
||||||
|
(firstBytes & ITypeMarshalBuffer.FLAG4) != 0, // rvalue reference
|
||||||
(firstBytes & ITypeMarshalBuffer.FLAG2) != 0); // takes varargs
|
(firstBytes & ITypeMarshalBuffer.FLAG2) != 0); // takes varargs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTClassVirtSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||||
|
@ -91,13 +92,13 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator.RefQualifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionWithTryBlock;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionWithTryBlock;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerList;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerList;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression.CaptureDefault;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression.CaptureDefault;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTClassVirtSpecifier;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTName;
|
||||||
|
@ -4224,7 +4225,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
endOffset= consume().getEndOffset();
|
endOffset= consume().getEndOffset();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cvloop: while(true) {
|
cvloop: while (true) {
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
case IToken.t_const:
|
case IToken.t_const:
|
||||||
fc.setConst(true);
|
fc.setConst(true);
|
||||||
|
@ -4240,6 +4241,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ref-qualifiers
|
||||||
|
switch (LT(1)) {
|
||||||
|
case IToken.tAMPER:
|
||||||
|
fc.setRefQualifier(RefQualifier.LVALUE);
|
||||||
|
endOffset= consume().getEndOffset();
|
||||||
|
break;
|
||||||
|
case IToken.tAND:
|
||||||
|
fc.setRefQualifier(RefQualifier.RVALUE);
|
||||||
|
endOffset= consume().getEndOffset();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// throws clause
|
// throws clause
|
||||||
if (LT(1) == IToken.t_throw) {
|
if (LT(1) == IToken.t_throw) {
|
||||||
fc.setEmptyExceptionSpecification();
|
fc.setEmptyExceptionSpecification();
|
||||||
|
|
|
@ -864,6 +864,7 @@ public class CPPTemplates {
|
||||||
if (i < parameters.length) {
|
if (i < parameters.length) {
|
||||||
par = parameters[i];
|
par = parameters[i];
|
||||||
} // else reuse last parameter (which should be a pack)
|
} // else reuse last parameter (which should be a pack)
|
||||||
|
@SuppressWarnings("null")
|
||||||
IValue defaultValue = par.getDefaultValue();
|
IValue defaultValue = par.getDefaultValue();
|
||||||
IValue specializedValue = CPPTemplates.instantiateValue(defaultValue, tpMap,
|
IValue specializedValue = CPPTemplates.instantiateValue(defaultValue, tpMap,
|
||||||
packOffset, within, maxdepth, point);
|
packOffset, within, maxdepth, point);
|
||||||
|
@ -1325,7 +1326,8 @@ public class CPPTemplates {
|
||||||
params[i]= CPPVisitor.adjustParameterType(p, true);
|
params[i]= CPPVisitor.adjustParameterType(p, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(),
|
||||||
|
ft.hasRefQualifier(), ft.isRValueReference(), ft.takesVarArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type instanceof ICPPTemplateParameter) {
|
if (type instanceof ICPPTemplateParameter) {
|
||||||
|
@ -2227,10 +2229,11 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICPPFunctionType originalType = function.getType();
|
ICPPFunctionType originalType = function.getType();
|
||||||
if (i == parameters.length) // no parameters with default arguments
|
if (i == parameters.length) // No parameters with default arguments.
|
||||||
return originalType;
|
return originalType;
|
||||||
return new CPPFunctionType(originalType.getReturnType(), ArrayUtil.trim(parameterTypes),
|
return new CPPFunctionType(originalType.getReturnType(), ArrayUtil.trim(parameterTypes),
|
||||||
originalType.isConst(), originalType.isVolatile(), originalType.takesVarArgs());
|
originalType.isConst(), originalType.isVolatile(), originalType.hasRefQualifier(),
|
||||||
|
originalType.isRValueReference(), originalType.takesVarArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compareSpecialization(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode, IASTNode point) throws DOMException {
|
private static int compareSpecialization(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode, IASTNode point) throws DOMException {
|
||||||
|
|
|
@ -112,6 +112,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator.RefQualifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
|
||||||
|
@ -1830,7 +1831,7 @@ public class CPPVisitor extends ASTQueries {
|
||||||
pTypes[i] = pt;
|
pTypes[i] = pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CPPFunctionType(returnType, pTypes, isConst, isVolatile, false);
|
return new CPPFunctionType(returnType, pTypes, isConst, isVolatile, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1869,7 +1870,9 @@ public class CPPVisitor extends ASTQueries {
|
||||||
returnType = getPointerTypes(returnType, fnDtor);
|
returnType = getPointerTypes(returnType, fnDtor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPFunctionType type = new CPPFunctionType(returnType, pTypes, fnDtor.isConst(), fnDtor.isVolatile(),
|
RefQualifier refQualifier = fnDtor.getRefQualifier();
|
||||||
|
CPPFunctionType type = new CPPFunctionType(returnType, pTypes, fnDtor.isConst(),
|
||||||
|
fnDtor.isVolatile(), refQualifier != null, refQualifier == RefQualifier.RVALUE,
|
||||||
fnDtor.takesVarArgs());
|
fnDtor.takesVarArgs());
|
||||||
final IASTDeclarator nested = fnDtor.getNestedDeclarator();
|
final IASTDeclarator nested = fnDtor.getNestedDeclarator();
|
||||||
if (nested != null) {
|
if (nested != null) {
|
||||||
|
|
|
@ -355,7 +355,8 @@ public class SemanticUtil {
|
||||||
if (ret == r && params == ps) {
|
if (ret == r && params == ps) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(),
|
||||||
|
ft.hasRefQualifier(), ft.isRValueReference(), ft.takesVarArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef) {
|
||||||
|
@ -499,7 +500,8 @@ public class SemanticUtil {
|
||||||
if (ret == r) {
|
if (ret == r) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
return new CPPFunctionType(ret, ft.getParameterTypes(), ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
return new CPPFunctionType(ret, ft.getParameterTypes(), ft.isConst(), ft.isVolatile(),
|
||||||
|
ft.hasRefQualifier(), ft.isRValueReference(), ft.takesVarArgs());
|
||||||
}
|
}
|
||||||
if (type instanceof ITypeContainer) {
|
if (type instanceof ITypeContainer) {
|
||||||
final ITypeContainer tc = (ITypeContainer) type;
|
final ITypeContainer tc = (ITypeContainer) type;
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator.RefQualifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||||
|
@ -142,6 +143,17 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
scribe.printSpace();
|
scribe.printSpace();
|
||||||
scribe.print(Keywords.VOLATILE);
|
scribe.print(Keywords.VOLATILE);
|
||||||
}
|
}
|
||||||
|
RefQualifier refQualifier = funcDec.getRefQualifier();
|
||||||
|
if (refQualifier != null) {
|
||||||
|
switch (refQualifier) {
|
||||||
|
case LVALUE:
|
||||||
|
scribe.print(Keywords.cpAMPER);
|
||||||
|
break;
|
||||||
|
case RVALUE:
|
||||||
|
scribe.print(Keywords.cpAND);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (funcDec.isMutable()) {
|
if (funcDec.isMutable()) {
|
||||||
scribe.printSpace();
|
scribe.printSpace();
|
||||||
scribe.print(Keywords.MUTABLE);
|
scribe.print(Keywords.MUTABLE);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2013 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2014 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -157,7 +157,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
IType[] p= ft.getParameterTypes();
|
IType[] p= ft.getParameterTypes();
|
||||||
IType[] p2= getCompositeTypes(p);
|
IType[] p2= getCompositeTypes(p);
|
||||||
if (r != r2 || p != p2) {
|
if (r != r2 || p != p2) {
|
||||||
return new CPPFunctionType(r2, p2, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
|
return new CPPFunctionType(r2, p2, ft.isConst(), ft.isVolatile(),
|
||||||
|
ft.hasRefQualifier(), ft.isRValueReference(), ft.takesVarArgs());
|
||||||
}
|
}
|
||||||
return ft;
|
return ft;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2013 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2014 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -289,6 +289,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean needSpace = skipConstVolatileRestrict();
|
boolean needSpace = skipConstVolatileRestrict();
|
||||||
int token = peekNextToken();
|
int token = peekNextToken();
|
||||||
|
// Ref-qualifier.
|
||||||
|
if (token == Token.tAMPER || token == Token.tAND) {
|
||||||
|
scribe.printNextToken(token, true);
|
||||||
|
token = peekNextToken();
|
||||||
|
needSpace = true;
|
||||||
|
}
|
||||||
if (token == Token.t_throw || token == Token.tIDENTIFIER) {
|
if (token == Token.t_throw || token == Token.tIDENTIFIER) {
|
||||||
if (node instanceof ICPPASTFunctionDeclarator) {
|
if (node instanceof ICPPASTFunctionDeclarator) {
|
||||||
final IASTTypeId[] exceptionSpecification=
|
final IASTTypeId[] exceptionSpecification=
|
||||||
|
@ -1417,48 +1423,6 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
formatList(parameters, options, true, node.takesVarArgs(),
|
formatList(parameters, options, true, node.takesVarArgs(),
|
||||||
new FunctionDeclaratorTailFormatter(node, tailFormatter));
|
new FunctionDeclaratorTailFormatter(node, tailFormatter));
|
||||||
|
|
||||||
// IASTFileLocation fileLocation= node.getFileLocation();
|
|
||||||
// if (fileLocation != null &&
|
|
||||||
// scribe.scanner.getCurrentPosition() < fileLocation.getNodeOffset() + fileLocation.getNodeLength()) {
|
|
||||||
// skipConstVolatileRestrict();
|
|
||||||
//
|
|
||||||
// int token = peekNextToken();
|
|
||||||
// if (token == Token.t_throw || token == Token.tIDENTIFIER) {
|
|
||||||
// final IASTTypeId[] exceptionSpecification= node.getExceptionSpecification();
|
|
||||||
// if (exceptionSpecification != null && token == Token.t_throw)
|
|
||||||
// formatExceptionSpecification(exceptionSpecification);
|
|
||||||
// if (peekNextToken() == Token.tIDENTIFIER) {
|
|
||||||
// Alignment alignment = scribe.createAlignment(
|
|
||||||
// Alignment.TRAILING_TEXT,
|
|
||||||
// Alignment.M_COMPACT_SPLIT,
|
|
||||||
// 1,
|
|
||||||
// scribe.scanner.getCurrentPosition());
|
|
||||||
//
|
|
||||||
// scribe.enterAlignment(alignment);
|
|
||||||
// boolean ok = false;
|
|
||||||
// do {
|
|
||||||
// try {
|
|
||||||
// scribe.alignFragment(alignment, 0);
|
|
||||||
// // Skip the rest of the declarator.
|
|
||||||
// scribe.printTrailingComment();
|
|
||||||
// scribe.space();
|
|
||||||
// if (tailFormatter != null)
|
|
||||||
// tailFormatter.run();
|
|
||||||
// skipNode(node);
|
|
||||||
// ok = true;
|
|
||||||
// } catch (AlignmentException e) {
|
|
||||||
// scribe.redoAlignment(e);
|
|
||||||
// }
|
|
||||||
// } while (!ok);
|
|
||||||
// scribe.exitAlignment(alignment, true);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // Skip the rest (=0)
|
|
||||||
// scribe.printTrailingComment();
|
|
||||||
// scribe.space();
|
|
||||||
// skipNode(node);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,11 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode.CopyStyle;
|
import org.eclipse.cdt.core.dom.ast.IASTNode.CopyStyle;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
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.ICPPASTFunctionDeclarator;
|
||||||
|
@ -264,6 +264,7 @@ public class ImplementMethodRefactoring extends CRefactoring {
|
||||||
|
|
||||||
createdMethodDeclarator = nodeFactory.newFunctionDeclarator(qName);
|
createdMethodDeclarator = nodeFactory.newFunctionDeclarator(qName);
|
||||||
createdMethodDeclarator.setConst(functionDeclarator.isConst());
|
createdMethodDeclarator.setConst(functionDeclarator.isConst());
|
||||||
|
createdMethodDeclarator.setRefQualifier(functionDeclarator.getRefQualifier());
|
||||||
for (IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
|
for (IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
|
||||||
createdMethodDeclarator.addPointerOperator(pop.copy(CopyStyle.withLocations));
|
createdMethodDeclarator.addPointerOperator(pop.copy(CopyStyle.withLocations));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue