mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Reduced use of deprecated types and methods.
This commit is contained in:
parent
c6557f0a86
commit
f5238bf93f
3 changed files with 28 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2011 IBM Corporation and others.
|
* Copyright (c) 2006, 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
|
||||||
|
@ -243,6 +243,16 @@ public interface ICPPNodeFactory extends INodeFactory {
|
||||||
|
|
||||||
public IASTProblemTypeId newProblemTypeId(IASTProblem problem);
|
public IASTProblemTypeId newProblemTypeId(IASTProblem problem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link ICPPASTQualifiedName}.
|
||||||
|
* @since 5.7
|
||||||
|
*/
|
||||||
|
public ICPPASTQualifiedName newQualifiedName(ICPPASTName name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Replaced by {@link #newQualifiedName(ICPPASTName)}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public ICPPASTQualifiedName newQualifiedName();
|
public ICPPASTQualifiedName newQualifiedName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 IBM Corporation and others.
|
* Copyright (c) 2006, 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
|
||||||
|
@ -84,6 +84,7 @@ 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.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.ICPPASTNamedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
|
@ -557,6 +558,12 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public ICPPASTQualifiedName newQualifiedName(ICPPASTName name) {
|
||||||
|
return new CPPASTQualifiedName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
public ICPPASTQualifiedName newQualifiedName() {
|
public ICPPASTQualifiedName newQualifiedName() {
|
||||||
return new CPPASTQualifiedName();
|
return new CPPASTQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,10 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
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.ICPPASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTExplicitTemplateInstantiation;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointerToMember;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier;
|
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
|
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.ITokenStream;
|
import org.eclipse.cdt.core.dom.lrparser.action.ITokenStream;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.ParserUtil;
|
import org.eclipse.cdt.core.dom.lrparser.action.ParserUtil;
|
||||||
|
@ -39,7 +36,6 @@ import org.eclipse.cdt.core.dom.lrparser.action.cpp.ICPPSecondaryParserFactory;
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.gpp.GPPParsersym;
|
import org.eclipse.cdt.internal.core.dom.lrparser.gpp.GPPParsersym;
|
||||||
|
|
||||||
public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
||||||
|
|
||||||
private final ICPPNodeFactory nodeFactory;
|
private final ICPPNodeFactory nodeFactory;
|
||||||
|
|
||||||
private final ITokenMap gppTokenMap;
|
private final ITokenMap gppTokenMap;
|
||||||
|
@ -125,8 +121,6 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
||||||
astStack.push(declSpec);
|
astStack.push(declSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean hasRestrict(List<Object> tokens) {
|
private boolean hasRestrict(List<Object> tokens) {
|
||||||
for(Object o : tokens) {
|
for(Object o : tokens) {
|
||||||
IToken t = (IToken)o;
|
IToken t = (IToken)o;
|
||||||
|
@ -137,7 +131,6 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restrict is allowed as a keyword.
|
* Restrict is allowed as a keyword.
|
||||||
*/
|
*/
|
||||||
|
@ -147,22 +140,19 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
||||||
super.consumePointer();
|
super.consumePointer();
|
||||||
|
|
||||||
if(hasRestrict) {
|
if(hasRestrict) {
|
||||||
IGPPASTPointer gppPointer = nodeFactory.newPointerGPP();
|
IASTPointer gppPointer = nodeFactory.newPointer();
|
||||||
initializeGPPPointer((IASTPointer)astStack.pop(), gppPointer);
|
initializePointer((IASTPointer) astStack.pop(), gppPointer);
|
||||||
astStack.push(gppPointer);
|
astStack.push(gppPointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void initializePointer(IASTPointer pointer, IASTPointer gppPointer) {
|
||||||
private static void initializeGPPPointer(IASTPointer pointer, IGPPASTPointer gppPointer) {
|
|
||||||
gppPointer.setConst(pointer.isConst());
|
gppPointer.setConst(pointer.isConst());
|
||||||
gppPointer.setVolatile(pointer.isVolatile());
|
gppPointer.setVolatile(pointer.isVolatile());
|
||||||
gppPointer.setRestrict(true);
|
gppPointer.setRestrict(true);
|
||||||
ParserUtil.setOffsetAndLength(gppPointer, pointer);
|
ParserUtil.setOffsetAndLength(gppPointer, pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void consumePointerToMember() {
|
public void consumePointerToMember() {
|
||||||
boolean hasRestrict = hasRestrict(astStack.topScope());
|
boolean hasRestrict = hasRestrict(astStack.topScope());
|
||||||
|
@ -170,23 +160,21 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
|
||||||
|
|
||||||
if(hasRestrict) {
|
if(hasRestrict) {
|
||||||
ICPPASTPointerToMember pointer = (ICPPASTPointerToMember) astStack.pop();
|
ICPPASTPointerToMember pointer = (ICPPASTPointerToMember) astStack.pop();
|
||||||
IGPPASTPointerToMember gppPointer = nodeFactory.newPointerToMemberGPP(pointer.getName());
|
ICPPASTPointerToMember gppPointer = nodeFactory.newPointerToMember(pointer.getName());
|
||||||
initializeGPPPointer(pointer, gppPointer);
|
initializePointer(pointer, gppPointer);
|
||||||
astStack.push(gppPointer);
|
astStack.push(gppPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void consumeTemplateExplicitInstantiationGCC(int modifier) {
|
public void consumeTemplateExplicitInstantiationGCC(int modifier) {
|
||||||
IASTDeclaration declaration = (IASTDeclaration) astStack.pop();
|
IASTDeclaration declaration = (IASTDeclaration) astStack.pop();
|
||||||
IGPPASTExplicitTemplateInstantiation instantiation = nodeFactory.newExplicitTemplateInstantiationGPP(declaration);
|
ICPPASTExplicitTemplateInstantiation instantiation = nodeFactory.newExplicitTemplateInstantiation(declaration);
|
||||||
instantiation.setModifier(modifier);
|
instantiation.setModifier(modifier);
|
||||||
setOffsetAndLength(instantiation);
|
setOffsetAndLength(instantiation);
|
||||||
astStack.push(instantiation);
|
astStack.push(instantiation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* postfix_expression ::= '(' type_id ')' initializer_list
|
* postfix_expression ::= '(' type_id ')' initializer_list
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue