mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 305978: [C++0x] Defaulted and deleted functions.
This commit is contained in:
parent
475aebee89
commit
f1bab4f41f
14 changed files with 217 additions and 47 deletions
|
@ -82,6 +82,7 @@ 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.ICPPASTConversionName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||
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.ICPPASTNamedTypeSpecifier;
|
||||
|
@ -8649,4 +8650,37 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
ors= ClassTypeHelper.findOverridden(m3);
|
||||
assertEquals(0, ors.length);
|
||||
}
|
||||
|
||||
// struct X {
|
||||
// X();
|
||||
// };
|
||||
// X::X() = default;
|
||||
// int f(int) = delete;
|
||||
// auto g() -> int = delete;
|
||||
public void testDefaultedAndDeletedFunctions_305978() throws Exception {
|
||||
String code= getAboveComment();
|
||||
IASTTranslationUnit tu= parseAndCheckBindings(code);
|
||||
|
||||
ICPPASTFunctionDefinition f= getDeclaration(tu, 1);
|
||||
assertTrue(f.isDefaulted());
|
||||
assertFalse(f.isDeleted());
|
||||
|
||||
f= getDeclaration(tu, 2);
|
||||
assertFalse(f.isDefaulted());
|
||||
assertTrue(f.isDeleted());
|
||||
|
||||
f= getDeclaration(tu, 3);
|
||||
assertFalse(f.isDefaulted());
|
||||
assertTrue(f.isDeleted());
|
||||
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
||||
ICPPFunction fb= bh.assertNonProblem("X() =", 1);
|
||||
assertFalse(fb.isDeleted());
|
||||
|
||||
fb= bh.assertNonProblem("f(int)", 1);
|
||||
assertTrue(fb.isDeleted());
|
||||
|
||||
fb= bh.assertNonProblem("g()", 1);
|
||||
assertTrue(fb.isDeleted());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -43,4 +43,28 @@ public interface ICPPASTFunctionDefinition extends IASTFunctionDefinition {
|
|||
* @since 5.1
|
||||
*/
|
||||
public ICPPASTFunctionDefinition copy();
|
||||
|
||||
/**
|
||||
* Make this a defaulted function definition, e.g.: C::C() = default;
|
||||
* @since 5.3
|
||||
*/
|
||||
public void setIsDefaulted(boolean isDefaulted);
|
||||
|
||||
/**
|
||||
* Returns whether this is a defaulted function definition.
|
||||
* @since 5.3
|
||||
*/
|
||||
public boolean isDefaulted();
|
||||
|
||||
/**
|
||||
* Make this a deleted function definition, e.g.: void f() = delete;
|
||||
* @since 5.3
|
||||
*/
|
||||
public void setIsDeleted(boolean isDeleted);
|
||||
|
||||
/**
|
||||
* Returns whether this is a deleted function definition.
|
||||
* @since 5.3
|
||||
*/
|
||||
public boolean isDeleted();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -67,4 +67,10 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
|
|||
* @since 5.2
|
||||
*/
|
||||
public boolean hasParameterPack();
|
||||
|
||||
/**
|
||||
* Returns whether this is a function with a deleted function definition.
|
||||
* @since 5.3
|
||||
*/
|
||||
public boolean isDeleted();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -23,9 +23,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
|
||||
/**
|
||||
* Models a function definition without a try-block. If used for a constructor definition it may contain
|
||||
|
@ -39,6 +38,8 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
private IASTStatement bodyStatement;
|
||||
private ICPPASTConstructorChainInitializer[] memInits = null;
|
||||
private int memInitPos= -1;
|
||||
private boolean fDeleted= false;
|
||||
private boolean fDefaulted= false;
|
||||
|
||||
|
||||
public CPPASTFunctionDefinition() {
|
||||
|
@ -56,9 +57,9 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy());
|
||||
|
||||
if(declarator != null) {
|
||||
IASTDeclarator outer = CVisitor.findOutermostDeclarator(declarator);
|
||||
IASTDeclarator outer = ASTQueries.findOutermostDeclarator(declarator);
|
||||
outer = outer.copy();
|
||||
copy.setDeclarator((IASTFunctionDeclarator)CVisitor.findTypeRelevantDeclarator(outer));
|
||||
copy.setDeclarator((IASTFunctionDeclarator)ASTQueries.findTypeRelevantDeclarator(outer));
|
||||
}
|
||||
|
||||
copy.setBody(bodyStatement == null ? null : bodyStatement.copy());
|
||||
|
@ -66,6 +67,8 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
for(ICPPASTConstructorChainInitializer initializer : getMemberInitializers())
|
||||
copy.addMemberInitializer(initializer == null ? null : initializer.copy());
|
||||
|
||||
copy.fDefaulted= fDefaulted;
|
||||
copy.fDeleted= fDeleted;
|
||||
copy.setOffsetAndLength(this);
|
||||
return copy;
|
||||
}
|
||||
|
@ -91,7 +94,7 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
assertNotFrozen();
|
||||
this.declarator = declarator;
|
||||
if (declarator != null) {
|
||||
IASTDeclarator outerDtor= CPPVisitor.findOutermostDeclarator(declarator);
|
||||
IASTDeclarator outerDtor= ASTQueries.findOutermostDeclarator(declarator);
|
||||
outerDtor.setParent(this);
|
||||
outerDtor.setPropertyInParent(DECLARATOR);
|
||||
}
|
||||
|
@ -132,7 +135,25 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
return ((ICPPASTFunctionDeclarator)declarator).getFunctionScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaulted() {
|
||||
return fDefaulted;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return fDeleted;
|
||||
}
|
||||
|
||||
public void setIsDefaulted(boolean isDefaulted) {
|
||||
assertNotFrozen();
|
||||
fDefaulted= isDefaulted;
|
||||
}
|
||||
|
||||
public void setIsDeleted(boolean isDeleted) {
|
||||
assertNotFrozen();
|
||||
fDeleted= isDeleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitDeclarations) {
|
||||
switch (action.visit(this)) {
|
||||
|
@ -148,7 +169,7 @@ public class CPPASTFunctionDefinition extends ASTNode implements
|
|||
if (declSpecifier != null && !declSpecifier.accept(action))
|
||||
return false;
|
||||
|
||||
final IASTDeclarator outerDtor = CPPVisitor.findOutermostDeclarator(declarator);
|
||||
final IASTDeclarator outerDtor = ASTQueries.findOutermostDeclarator(declarator);
|
||||
if (outerDtor != null && !outerDtor.accept(action))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
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.ICPPASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
|
@ -84,7 +85,10 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isInline() throws DOMException {
|
||||
|
@ -471,7 +475,21 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
public boolean isDeleted() {
|
||||
return isDeletedDefinition(getDefinition());
|
||||
}
|
||||
|
||||
public static boolean isDeletedDefinition(IASTNode def) {
|
||||
while (def != null && !(def instanceof IASTDeclaration)) {
|
||||
def= def.getParent();
|
||||
}
|
||||
if (def instanceof ICPPASTFunctionDefinition) {
|
||||
return ((ICPPASTFunctionDefinition) def).isDeleted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -101,6 +101,18 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
IASTNode def = getDefinition();
|
||||
if (def != null)
|
||||
return CPPFunction.isDeletedDefinition(def);
|
||||
|
||||
IBinding f = getSpecializedBinding();
|
||||
if (f instanceof ICPPFunction) {
|
||||
return ((ICPPFunction) f).isDeleted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
if (getDefinition() != null) {
|
||||
IASTNode def = getDefinition();
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
|||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
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.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
|
@ -67,6 +66,9 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
|
@ -311,7 +313,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return hasStorageClass(ICPPASTDeclSpecifier.sc_mutable);
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_mutable);
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
|
@ -361,6 +363,10 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return CPPFunction.isDeletedDefinition(getDefinition());
|
||||
}
|
||||
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -43,6 +43,10 @@ public class CPPUnknownFunction extends CPPUnknownBinding implements ICPPFunctio
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isExternC() throws DOMException {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1972,6 +1972,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
case IToken.t_try:
|
||||
case IToken.tCOLON:
|
||||
case IToken.tLBRACE:
|
||||
case IToken.tASSIGN: // defaulted or deleted function definition
|
||||
if (declarators.length != 1)
|
||||
throwBacktrack(LA(1));
|
||||
|
||||
|
@ -2050,6 +2051,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
} else {
|
||||
fdef= nodeFactory.newFunctionDefinition(declSpec, (ICPPASTFunctionDeclarator) dtor, null);
|
||||
}
|
||||
if (LT(1) == IToken.tASSIGN) {
|
||||
consume();
|
||||
IToken kind= consume();
|
||||
switch(kind.getType()) {
|
||||
case IToken.t_default:
|
||||
fdef.setIsDefaulted(true);
|
||||
break;
|
||||
case IToken.t_delete:
|
||||
fdef.setIsDeleted(true);
|
||||
break;
|
||||
default:
|
||||
throwBacktrack(kind);
|
||||
}
|
||||
return adjustEndOffset(fdef, consume(IToken.tSEMI).getEndOffset());
|
||||
}
|
||||
|
||||
if (LT(1) == IToken.tCOLON) {
|
||||
ctorInitializer(fdef);
|
||||
}
|
||||
|
@ -2708,8 +2725,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
//$FALL-THROUGH$
|
||||
case IToken.t_throw: case IToken.t_try:
|
||||
case IToken.t_const: case IToken.t_volatile:
|
||||
case IToken.tARROW:
|
||||
if (ASTQueries.findTypeRelevantDeclarator(dtor1) instanceof IASTFunctionDeclarator) {
|
||||
case IToken.tASSIGN: // defaulted or deleted function definition
|
||||
if (option == DeclarationOptions.TYPEID_TRAILING_RETURN_TYPE ||
|
||||
ASTQueries.findTypeRelevantDeclarator(dtor1) instanceof IASTFunctionDeclarator) {
|
||||
return dtor1;
|
||||
} else {
|
||||
dtor1= null;
|
||||
|
@ -2904,6 +2922,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
|
||||
// = initializer-clause
|
||||
if (lt1 == IToken.tASSIGN) {
|
||||
// Check for deleted or defaulted function syntax.
|
||||
final int lt2= LTcatchEOF(2);
|
||||
if (lt2 == IToken.t_delete || lt2 == IToken.t_default)
|
||||
return null;
|
||||
|
||||
int offset= consume().getOffset();
|
||||
IASTInitializerClause initClause = initClause(LT(1) == IToken.tLBRACE);
|
||||
IASTEqualsInitializer initExpr= nodeFactory.newEqualsInitializer(initClause);
|
||||
|
|
|
@ -12,10 +12,10 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
|
@ -63,6 +63,10 @@ class AutoTypeResolver implements ICPPFunctionTemplate {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
return IType.EMPTY_TYPE_ARRAY;
|
||||
}
|
||||
|
|
|
@ -3260,36 +3260,41 @@ public class CPPSemantics {
|
|||
IBinding[] result = IBinding.EMPTY_BINDING_ARRAY;
|
||||
if (!map.isEmpty()) {
|
||||
char[] key = null;
|
||||
Object obj = null;
|
||||
int size = map.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
key = map.keyAt(i);
|
||||
obj = map.get(key);
|
||||
if (obj instanceof IBinding) {
|
||||
result = ArrayUtil.append(result, (IBinding) obj);
|
||||
} else if (obj instanceof IASTName) {
|
||||
IBinding binding = ((IASTName) obj).resolveBinding();
|
||||
if (binding != null && !(binding instanceof IProblemBinding))
|
||||
result = ArrayUtil.append(result, binding);
|
||||
} else if (obj instanceof Object[]) {
|
||||
Object[] objs = (Object[]) obj;
|
||||
for (int j = 0; j < objs.length && objs[j] != null; j++) {
|
||||
Object item = objs[j];
|
||||
if (item instanceof IBinding) {
|
||||
result = ArrayUtil.append(result, (IBinding) item);
|
||||
} else if (item instanceof IASTName) {
|
||||
IBinding binding = ((IASTName) item).resolveBinding();
|
||||
if (binding != null && !(binding instanceof IProblemBinding))
|
||||
result = ArrayUtil.append(result, binding);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = addContentAssistBinding(result, map.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
return ArrayUtil.trim(result);
|
||||
}
|
||||
|
||||
public static IBinding[] addContentAssistBinding(IBinding[] result, Object obj) {
|
||||
if (obj instanceof Object[]) {
|
||||
for (Object o : (Object[]) obj) {
|
||||
result= addContentAssistBinding(result, o);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (obj instanceof IASTName) {
|
||||
return addContentAssistBinding(result, ((IASTName) obj).resolveBinding());
|
||||
}
|
||||
|
||||
if (obj instanceof IBinding && !(obj instanceof IProblemBinding)) {
|
||||
final IBinding binding = (IBinding) obj;
|
||||
if (binding instanceof ICPPFunction) {
|
||||
final ICPPFunction function = (ICPPFunction) binding;
|
||||
if (function.isDeleted()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return ArrayUtil.append(result, binding);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static IBinding[] standardLookup(LookupData data, IScope start) {
|
||||
try {
|
||||
lookup(data, start);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2010 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
|
||||
|
@ -56,6 +56,10 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
|||
return (ICPPFunctionType) cf.getCompositeType(rtype);
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return ((ICPPFunction)rbinding).isDeleted();
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
return ((ICPPFunction)rbinding).isAuto();
|
||||
}
|
||||
|
|
|
@ -199,10 +199,11 @@ public class PDOM extends PlatformObject implements IPDOM {
|
|||
* CDT 8.0 development (versions not supported on the 7.0.x branch)
|
||||
* 110.0 - update index on encoding change, bug 317435.
|
||||
* 111.0 - correct marshalling of basic types, bug 319186.
|
||||
* 111.1 - defaulted and deleted functions, bug 305978
|
||||
*/
|
||||
private static final int MIN_SUPPORTED_VERSION= version(111, 0);
|
||||
private static final int MAX_SUPPORTED_VERSION= version(111, Short.MAX_VALUE);
|
||||
private static final int DEFAULT_VERSION = version(111, 0);
|
||||
private static final int DEFAULT_VERSION = version(111, 1);
|
||||
|
||||
private static int version(int major, int minor) {
|
||||
return (major << 16) + minor;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -38,7 +38,8 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverloader {
|
||||
|
||||
private static final short ANNOT_PARAMETER_PACK = 0x100;
|
||||
private static final short ANNOT_PARAMETER_PACK = 8;
|
||||
private static final short ANNOT_IS_DELETED = 9;
|
||||
|
||||
/**
|
||||
* Offset of total number of function parameters (relative to the
|
||||
|
@ -101,7 +102,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
private short getAnnotation(ICPPFunction function) throws DOMException {
|
||||
int annot= PDOMCPPAnnotation.encodeAnnotation(function);
|
||||
if (function.hasParameterPack()) {
|
||||
annot |= ANNOT_PARAMETER_PACK;
|
||||
annot |= (1<<ANNOT_PARAMETER_PACK);
|
||||
}
|
||||
if (function.isDeleted()) {
|
||||
annot |= (1<<ANNOT_IS_DELETED);
|
||||
}
|
||||
return (short) annot;
|
||||
}
|
||||
|
@ -319,6 +323,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return getBit(getAnnotation(), ANNOT_IS_DELETED);
|
||||
}
|
||||
|
||||
public boolean isExtern() {
|
||||
return getBit(getAnnotation(), PDOMCAnnotation.EXTERN_OFFSET);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue