1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Reduced use of deprecated types and methods.

This commit is contained in:
Sergey Prigogin 2014-03-06 15:15:19 -08:00
parent c6557f0a86
commit f5238bf93f
3 changed files with 28 additions and 23 deletions

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -243,6 +243,16 @@ public interface ICPPNodeFactory extends INodeFactory {
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();
/**

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* 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.ICPPASTLinkageSpecification;
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.ICPPASTNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
@ -557,6 +558,12 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
}
@Override
public ICPPASTQualifiedName newQualifiedName(ICPPASTName name) {
return new CPPASTQualifiedName(name);
}
@Override
@Deprecated
public ICPPASTQualifiedName newQualifiedName() {
return new CPPASTQualifiedName();
}

View file

@ -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.IASTTypeId;
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.ICPPASTSimpleDeclSpecifier;
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.ITokenStream;
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;
public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
private final ICPPNodeFactory nodeFactory;
private final ITokenMap gppTokenMap;
@ -125,8 +121,6 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
astStack.push(declSpec);
}
private boolean hasRestrict(List<Object> tokens) {
for(Object o : tokens) {
IToken t = (IToken)o;
@ -137,7 +131,6 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
return false;
}
/**
* Restrict is allowed as a keyword.
*/
@ -147,22 +140,19 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
super.consumePointer();
if(hasRestrict) {
IGPPASTPointer gppPointer = nodeFactory.newPointerGPP();
initializeGPPPointer((IASTPointer)astStack.pop(), gppPointer);
IASTPointer gppPointer = nodeFactory.newPointer();
initializePointer((IASTPointer) astStack.pop(), gppPointer);
astStack.push(gppPointer);
}
}
private static void initializeGPPPointer(IASTPointer pointer, IGPPASTPointer gppPointer) {
private static void initializePointer(IASTPointer pointer, IASTPointer gppPointer) {
gppPointer.setConst(pointer.isConst());
gppPointer.setVolatile(pointer.isVolatile());
gppPointer.setRestrict(true);
ParserUtil.setOffsetAndLength(gppPointer, pointer);
}
@Override
public void consumePointerToMember() {
boolean hasRestrict = hasRestrict(astStack.topScope());
@ -170,23 +160,21 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
if(hasRestrict) {
ICPPASTPointerToMember pointer = (ICPPASTPointerToMember) astStack.pop();
IGPPASTPointerToMember gppPointer = nodeFactory.newPointerToMemberGPP(pointer.getName());
initializeGPPPointer(pointer, gppPointer);
ICPPASTPointerToMember gppPointer = nodeFactory.newPointerToMember(pointer.getName());
initializePointer(pointer, gppPointer);
astStack.push(gppPointer);
}
}
public void consumeTemplateExplicitInstantiationGCC(int modifier) {
IASTDeclaration declaration = (IASTDeclaration) astStack.pop();
IGPPASTExplicitTemplateInstantiation instantiation = nodeFactory.newExplicitTemplateInstantiationGPP(declaration);
ICPPASTExplicitTemplateInstantiation instantiation = nodeFactory.newExplicitTemplateInstantiation(declaration);
instantiation.setModifier(modifier);
setOffsetAndLength(instantiation);
astStack.push(instantiation);
}
/**
* postfix_expression ::= '(' type_id ')' initializer_list
*/