mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
bug 89389
This commit is contained in:
parent
82b1a286d2
commit
f25c314c0a
23 changed files with 94 additions and 69 deletions
|
@ -33,6 +33,11 @@ public interface IProblemBinding extends IBinding, IScope, IType {
|
||||||
*/
|
*/
|
||||||
String getMessage();
|
String getMessage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the AST node that this problem was created for
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IASTNode getASTNode();
|
||||||
/*
|
/*
|
||||||
* Parser Semantic Problems
|
* Parser Semantic Problems
|
||||||
* All Semantic problems take a char[] as an argument
|
* All Semantic problems take a char[] as an argument
|
||||||
|
|
|
@ -32,12 +32,17 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
|
||||||
public class ProblemBinding implements IProblemBinding, IType, IScope {
|
public class ProblemBinding implements IProblemBinding, IType, IScope {
|
||||||
private final int id;
|
private final int id;
|
||||||
private final char [] arg;
|
private final char [] arg;
|
||||||
|
private IASTNode node;
|
||||||
private String message = null;
|
private String message = null;
|
||||||
|
|
||||||
public ProblemBinding( int id, char [] arg ){
|
public ProblemBinding( IASTNode node, int id, char [] arg ){
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
|
this.node = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTNode getASTNode(){
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
|
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class CEnumeration implements IEnumeration {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null )
|
if( definition == null )
|
||||||
return new IEnumerator[] { new CEnumerator.CEnumeratorProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, declarations[0].toCharArray() ) };
|
return new IEnumerator[] { new CEnumerator.CEnumeratorProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, declarations[0].toCharArray() ) };
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTEnumerationSpecifier enumSpec = (IASTEnumerationSpecifier) definition.getParent();
|
IASTEnumerationSpecifier enumSpec = (IASTEnumerationSpecifier) definition.getParent();
|
||||||
|
|
|
@ -30,8 +30,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
*/
|
*/
|
||||||
public class CEnumerator implements IEnumerator {
|
public class CEnumerator implements IEnumerator {
|
||||||
public static class CEnumeratorProblem extends ProblemBinding implements IEnumerator {
|
public static class CEnumeratorProblem extends ProblemBinding implements IEnumerator {
|
||||||
public CEnumeratorProblem( int id, char[] arg ) {
|
public CEnumeratorProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() throws DOMException {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
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.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +21,8 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
*/
|
*/
|
||||||
public class CField extends CVariable implements IField {
|
public class CField extends CVariable implements IField {
|
||||||
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
|
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
|
||||||
public CFieldProblem( int id, char[] arg ) {
|
public CFieldProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class CFunction implements IFunction, ICInternalBinding {
|
||||||
if( decl != null ) {
|
if( decl != null ) {
|
||||||
result[i] = (IParameter) decl.getName().resolveBinding();
|
result[i] = (IParameter) decl.getName().resolveBinding();
|
||||||
} else {
|
} else {
|
||||||
result[i] = new CParameter.CParameterProblem( IProblemBinding.SEMANTIC_KNR_PARAMETER_DECLARATION_NOT_FOUND, names[i].toCharArray() );
|
result[i] = new CParameter.CParameterProblem( names[i], IProblemBinding.SEMANTIC_KNR_PARAMETER_DECLARATION_NOT_FOUND, names[i].toCharArray() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
public class CLabel implements ILabel {
|
public class CLabel implements ILabel {
|
||||||
|
|
||||||
public static class CLabelProblem extends ProblemBinding implements ILabel {
|
public static class CLabelProblem extends ProblemBinding implements ILabel {
|
||||||
public CLabelProblem( int id, char[] arg ) {
|
public CLabelProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTLabelStatement getLabelStatement() throws DOMException{
|
public IASTLabelStatement getLabelStatement() throws DOMException{
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
*/
|
*/
|
||||||
public class CParameter implements IParameter {
|
public class CParameter implements IParameter {
|
||||||
public static class CParameterProblem extends ProblemBinding implements IParameter {
|
public static class CParameterProblem extends ProblemBinding implements IParameter {
|
||||||
public CParameterProblem( int id, char[] arg ) {
|
public CParameterProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() throws DOMException {
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class CStructure implements ICompositeType, ICInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
|
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
|
||||||
if( temp == null )
|
if( temp == null )
|
||||||
return new IField [] { new CField.CFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
return new IField [] { new CField.CFieldProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
definition = temp.getName();
|
definition = temp.getName();
|
||||||
}
|
}
|
||||||
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
|
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
|
||||||
|
@ -134,7 +134,7 @@ public class CStructure implements ICompositeType, ICInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
|
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
|
||||||
if( temp == null )
|
if( temp == null )
|
||||||
return new CField.CFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() );
|
return new CField.CFieldProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() );
|
||||||
definition = temp.getName();
|
definition = temp.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
*/
|
*/
|
||||||
public class CVariable implements IVariable, ICInternalBinding {
|
public class CVariable implements IVariable, ICInternalBinding {
|
||||||
public static class CVariableProblem extends ProblemBinding implements IVariable {
|
public static class CVariableProblem extends ProblemBinding implements IVariable {
|
||||||
public CVariableProblem( int id, char[] arg ) {
|
public CVariableProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() throws DOMException {
|
||||||
|
|
|
@ -475,7 +475,7 @@ public class CVisitor {
|
||||||
if( binding instanceof CEnumeration )
|
if( binding instanceof CEnumeration )
|
||||||
((CEnumeration)binding).addDefinition( name );
|
((CEnumeration)binding).addDefinition( name );
|
||||||
else
|
else
|
||||||
return new ProblemBinding(IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
return new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
||||||
} else {
|
} else {
|
||||||
binding = new CEnumeration( name );
|
binding = new CEnumeration( name );
|
||||||
try {
|
try {
|
||||||
|
@ -507,7 +507,7 @@ public class CVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//label not found
|
//label not found
|
||||||
return new CLabel.CLabelProblem( IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName );
|
return new CLabel.CLabelProblem( ((IASTGotoStatement)statement).getName(), IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName );
|
||||||
}
|
}
|
||||||
} else if( statement instanceof IASTLabelStatement ){
|
} else if( statement instanceof IASTLabelStatement ){
|
||||||
IASTName name = ((IASTLabelStatement)statement).getName();
|
IASTName name = ((IASTLabelStatement)statement).getName();
|
||||||
|
@ -655,7 +655,7 @@ public class CVisitor {
|
||||||
if( binding instanceof IFunction )
|
if( binding instanceof IFunction )
|
||||||
((CFunction)binding).addDeclarator( (IASTStandardFunctionDeclarator) declarator );
|
((CFunction)binding).addDeclarator( (IASTStandardFunctionDeclarator) declarator );
|
||||||
else
|
else
|
||||||
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
binding = new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
||||||
} else {
|
} else {
|
||||||
binding = createBinding(declarator);
|
binding = createBinding(declarator);
|
||||||
}
|
}
|
||||||
|
@ -666,7 +666,7 @@ public class CVisitor {
|
||||||
if( binding instanceof IFunction )
|
if( binding instanceof IFunction )
|
||||||
((CFunction)binding).addDeclarator( (ICASTKnRFunctionDeclarator) declarator );
|
((CFunction)binding).addDeclarator( (ICASTKnRFunctionDeclarator) declarator );
|
||||||
else
|
else
|
||||||
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
binding = new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
|
||||||
} else {
|
} else {
|
||||||
binding = createBinding(declarator);
|
binding = createBinding(declarator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
|
@ -27,8 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
*/
|
*/
|
||||||
public class CPPBaseClause implements ICPPBase {
|
public class CPPBaseClause implements ICPPBase {
|
||||||
static public class CPPBaseProblem extends ProblemBinding implements ICPPBase {
|
static public class CPPBaseProblem extends ProblemBinding implements ICPPBase {
|
||||||
public CPPBaseProblem( int id, char[] arg ) {
|
public CPPBaseProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
public ICPPClassType getBaseClass() throws DOMException {
|
public ICPPClassType getBaseClass() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException( this );
|
||||||
|
@ -56,10 +57,10 @@ public class CPPBaseClause implements ICPPBase {
|
||||||
if( baseClass instanceof ICPPClassType )
|
if( baseClass instanceof ICPPClassType )
|
||||||
return (ICPPClassType) baseClass;
|
return (ICPPClassType) baseClass;
|
||||||
else if( baseClass instanceof IProblemBinding ){
|
else if( baseClass instanceof IProblemBinding ){
|
||||||
return new CPPClassType.CPPClassTypeProblem( ((IProblemBinding)baseClass).getID(), base.getName().toCharArray() );
|
return new CPPClassType.CPPClassTypeProblem( base.getName(), ((IProblemBinding)baseClass).getID(), base.getName().toCharArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CPPClassType.CPPClassTypeProblem( IProblemBinding.SEMANTIC_NAME_NOT_FOUND, base.getName().toCharArray() );
|
return new CPPClassType.CPPClassTypeProblem( base.getName(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND, base.getName().toCharArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -239,7 +239,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
*/
|
*/
|
||||||
public ICPPMethod[] getImplicitMethods() {
|
public ICPPMethod[] getImplicitMethods() {
|
||||||
if( implicits == null )
|
if( implicits == null )
|
||||||
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_INVALID_TYPE, CPPSemantics.EMPTY_NAME_ARRAY ) };
|
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem( null, IProblemBinding.SEMANTIC_INVALID_TYPE, CPPSemantics.EMPTY_NAME_ARRAY ) };
|
||||||
return implicits;
|
return implicits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class CPPClassTypeProblem extends ProblemBinding implements ICPPClassType{
|
public static class CPPClassTypeProblem extends ProblemBinding implements ICPPClassType{
|
||||||
public CPPClassTypeProblem( int id, char[] arg ) {
|
public CPPClassTypeProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPBase[] getBases() throws DOMException {
|
public ICPPBase[] getBases() throws DOMException {
|
||||||
|
@ -249,8 +249,10 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
public IField[] getFields() throws DOMException {
|
public IField[] getFields() throws DOMException {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null )
|
if( definition == null ){
|
||||||
return new IField [] { new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new IField [] { new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IField[] fields = getDeclaredFields();
|
IField[] fields = getDeclaredFields();
|
||||||
|
@ -272,7 +274,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( field == null )
|
if( field == null )
|
||||||
field = (IField) bindings[i];
|
field = (IField) bindings[i];
|
||||||
else {
|
else {
|
||||||
return new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, name.toCharArray() );
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, name.toCharArray() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +372,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
return new ICPPBase [] { new CPPBaseClause.CPPBaseProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new ICPPBase [] { new CPPBaseClause.CPPBaseProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICPPASTBaseSpecifier [] bases = getCompositeTypeSpecifier().getBaseSpecifiers();
|
ICPPASTBaseSpecifier [] bases = getCompositeTypeSpecifier().getBaseSpecifiers();
|
||||||
|
@ -391,7 +395,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
return new ICPPField[] { new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new ICPPField[] { new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IBinding binding = null;
|
IBinding binding = null;
|
||||||
|
@ -445,8 +450,10 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null )
|
if( definition == null ){
|
||||||
return new ICPPMethod [] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new ICPPMethod [] { new CPPMethod.CPPMethodProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICPPMethod[] methods = getDeclaredMethods();
|
ICPPMethod[] methods = getDeclaredMethods();
|
||||||
|
@ -464,7 +471,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
return new ICPPMethod[] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new ICPPMethod[] { new CPPMethod.CPPMethodProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IBinding binding = null;
|
IBinding binding = null;
|
||||||
|
@ -520,7 +528,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
return new ICPPConstructor [] { new CPPConstructor.CPPConstructorProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new ICPPConstructor [] { new CPPConstructor.CPPConstructorProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +561,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
checkForDefinition();
|
checkForDefinition();
|
||||||
if( definition == null ){
|
if( definition == null ){
|
||||||
return new IBinding [] { new ProblemBinding( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
|
||||||
|
return new IBinding [] { new ProblemBinding( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ObjectSet resultSet = new ObjectSet(2);
|
ObjectSet resultSet = new ObjectSet(2);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
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.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
||||||
|
|
||||||
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
|
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
|
||||||
public CPPConstructorProblem( int id, char[] arg ) {
|
public CPPConstructorProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExplicit() throws DOMException{
|
public boolean isExplicit() throws DOMException{
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
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.cpp.ICPPDelegate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
|
||||||
|
@ -35,8 +36,8 @@ public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBind
|
||||||
* @param id
|
* @param id
|
||||||
* @param arg
|
* @param arg
|
||||||
*/
|
*/
|
||||||
public CPPFieldProblem( int id, char[] arg ) {
|
public CPPFieldProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class CPPFunction implements ICPPFunction, ICPPInternalBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class CPPFunctionProblem extends ProblemBinding implements ICPPFunction {
|
public static class CPPFunctionProblem extends ProblemBinding implements ICPPFunction {
|
||||||
public CPPFunctionProblem( int id, char[] arg ) {
|
public CPPFunctionProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() throws DOMException {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
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.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
|
@ -48,8 +49,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
* @param id
|
* @param id
|
||||||
* @param arg
|
* @param arg
|
||||||
*/
|
*/
|
||||||
public CPPMethodProblem( int id, char[] arg ) {
|
public CPPMethodProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class CPPPointerToMemberType extends CPPPointerType implements
|
||||||
if( binding instanceof ICPPClassType ){
|
if( binding instanceof ICPPClassType ){
|
||||||
clsType = (ICPPClassType) binding;
|
clsType = (ICPPClassType) binding;
|
||||||
} else {
|
} else {
|
||||||
clsType = new CPPClassType.CPPClassTypeProblem( IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray() );
|
clsType = new CPPClassType.CPPClassTypeProblem( name, IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clsType;
|
return clsType;
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
*/
|
*/
|
||||||
abstract public class CPPScope implements ICPPScope{
|
abstract public class CPPScope implements ICPPScope{
|
||||||
public static class CPPScopeProblem extends ProblemBinding implements ICPPScope {
|
public static class CPPScopeProblem extends ProblemBinding implements ICPPScope {
|
||||||
public CPPScopeProblem( int id, char[] arg ) {
|
public CPPScopeProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
public void addName( IASTName name ) throws DOMException {
|
public void addName( IASTName name ) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException( this );
|
||||||
|
@ -59,8 +59,8 @@ abstract public class CPPScope implements ICPPScope{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class CPPTemplateProblem extends CPPScopeProblem {
|
public static class CPPTemplateProblem extends CPPScopeProblem {
|
||||||
public CPPTemplateProblem(int id, char[] arg) {
|
public CPPTemplateProblem( IASTNode node, int id, char[] arg) {
|
||||||
super(id, arg);
|
super( node, id, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -467,7 +467,7 @@ public class CPPSemantics {
|
||||||
|
|
||||||
}
|
}
|
||||||
if( data.astName.getPropertyInParent() == IASTNamedTypeSpecifier.NAME && !( binding instanceof IType || binding instanceof ICPPConstructor) ){
|
if( data.astName.getPropertyInParent() == IASTNamedTypeSpecifier.NAME && !( binding instanceof IType || binding instanceof ICPPConstructor) ){
|
||||||
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_TYPE, data.name );
|
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_INVALID_TYPE, data.name );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( binding != null && !( binding instanceof IProblemBinding ) ){
|
if( binding != null && !( binding instanceof IProblemBinding ) ){
|
||||||
|
@ -476,7 +476,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( binding == null )
|
if( binding == null )
|
||||||
binding = new ProblemBinding(IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name );
|
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name );
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,7 +807,7 @@ public class CPPSemantics {
|
||||||
visitVirtualBaseClasses( data, cls );
|
visitVirtualBaseClasses( data, cls );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, bases[i].getName().toCharArray() );
|
data.problem = new ProblemBinding( bases[i].getName(), IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, bases[i].getName().toCharArray() );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,13 +821,13 @@ public class CPPSemantics {
|
||||||
Object [] r = (Object[]) result;
|
Object [] r = (Object[]) result;
|
||||||
for( int j = 0; j < r.length && r[j] != null; j++ ) {
|
for( int j = 0; j < r.length && r[j] != null; j++ ) {
|
||||||
if( checkForAmbiguity( r[j], inherited ) ){
|
if( checkForAmbiguity( r[j], inherited ) ){
|
||||||
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
data.problem = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( checkForAmbiguity( result, inherited ) ){
|
if( checkForAmbiguity( result, inherited ) ){
|
||||||
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
data.problem = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1377,7 +1377,7 @@ public class CPPSemantics {
|
||||||
if( type == null ){
|
if( type == null ){
|
||||||
type = temp;
|
type = temp;
|
||||||
} else if( type != temp ) {
|
} else if( type != temp ) {
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
}
|
}
|
||||||
} else if( temp instanceof IFunction ){
|
} else if( temp instanceof IFunction ){
|
||||||
fns = (IFunction[]) ArrayUtil.append( IFunction.class, fns, temp );
|
fns = (IFunction[]) ArrayUtil.append( IFunction.class, fns, temp );
|
||||||
|
@ -1385,14 +1385,14 @@ public class CPPSemantics {
|
||||||
if( obj == null )
|
if( obj == null )
|
||||||
obj = temp;
|
obj = temp;
|
||||||
else if( obj != temp ){
|
else if( obj != temp ){
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( data.forUsingDeclaration() ){
|
if( data.forUsingDeclaration() ){
|
||||||
IBinding [] bindings = null;
|
IBinding [] bindings = null;
|
||||||
if( obj != null ){
|
if( obj != null ){
|
||||||
if( fns != null ) return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
if( fns != null ) return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
// if( type == null ) return obj;
|
// if( type == null ) return obj;
|
||||||
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, obj );
|
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, obj );
|
||||||
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, type );
|
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, type );
|
||||||
|
@ -1412,7 +1412,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
if( fns != null){
|
if( fns != null){
|
||||||
if( obj != null )
|
if( obj != null )
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
return resolveFunction( data, fns );
|
return resolveFunction( data, fns );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1690,7 +1690,7 @@ public class CPPSemantics {
|
||||||
|
|
||||||
|
|
||||||
if( ambiguous || bestHasAmbiguousParam ){
|
if( ambiguous || bestHasAmbiguousParam ){
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
}
|
}
|
||||||
|
|
||||||
return bestFn;
|
return bestFn;
|
||||||
|
@ -1724,7 +1724,7 @@ public class CPPSemantics {
|
||||||
while( type != null ){
|
while( type != null ){
|
||||||
type = (type != null) ? getUltimateType( type, false ) : null;
|
type = (type != null) ? getUltimateType( type, false ) : null;
|
||||||
if( type == null || !( type instanceof IFunctionType ) )
|
if( type == null || !( type instanceof IFunctionType ) )
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
|
|
||||||
for( int i = 0; i < fns.length; i++ ){
|
for( int i = 0; i < fns.length; i++ ){
|
||||||
IFunction fn = (IFunction) fns[i];
|
IFunction fn = (IFunction) fns[i];
|
||||||
|
@ -1738,7 +1738,7 @@ public class CPPSemantics {
|
||||||
if( result == null )
|
if( result == null )
|
||||||
result = fn;
|
result = fn;
|
||||||
else
|
else
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,7 +1749,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( result != null ) ? result : new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
return ( result != null ) ? result : new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getTargetType( LookupData data ){
|
private static Object getTargetType( LookupData data ){
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class CPPVariable implements ICPPVariable, ICPPInternalBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class CPPVariableProblem extends ProblemBinding implements ICPPVariable{
|
public static class CPPVariableProblem extends ProblemBinding implements ICPPVariable{
|
||||||
public CPPVariableProblem( int id, char[] arg ) {
|
public CPPVariableProblem( IASTNode node, int id, char[] arg ) {
|
||||||
super( id, arg );
|
super( node, id, arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() throws DOMException {
|
||||||
|
|
|
@ -367,7 +367,7 @@ public class CPPVisitor {
|
||||||
binding = new CPPNamespaceAlias( alias.getAlias(), (ICPPNamespace) namespace );
|
binding = new CPPNamespaceAlias( alias.getAlias(), (ICPPNamespace) namespace );
|
||||||
scope.addName( alias.getAlias() );
|
scope.addName( alias.getAlias() );
|
||||||
} else {
|
} else {
|
||||||
binding = new ProblemBinding( IProblemBinding.SEMANTIC_NAME_NOT_FOUND, alias.getAlias().toCharArray() );
|
binding = new ProblemBinding( alias.getAlias(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND, alias.getAlias().toCharArray() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch( DOMException e ){
|
} catch( DOMException e ){
|
||||||
|
@ -494,7 +494,7 @@ public class CPPVisitor {
|
||||||
if( t1.equals( t2 ) ){
|
if( t1.equals( t2 ) ){
|
||||||
((CPPVariable)binding).addDeclaration( declarator.getName() );
|
((CPPVariable)binding).addDeclaration( declarator.getName() );
|
||||||
} else {
|
} else {
|
||||||
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_REDECLARATION, declarator.getName().toCharArray() );
|
binding = new ProblemBinding( declarator.getName(), IProblemBinding.SEMANTIC_INVALID_REDECLARATION, declarator.getName().toCharArray() );
|
||||||
}
|
}
|
||||||
} else if( simpleDecl.getParent() instanceof ICPPASTCompositeTypeSpecifier ){
|
} else if( simpleDecl.getParent() instanceof ICPPASTCompositeTypeSpecifier ){
|
||||||
binding = new CPPField( declarator.getName() );
|
binding = new CPPField( declarator.getName() );
|
||||||
|
@ -637,7 +637,7 @@ public class CPPVisitor {
|
||||||
} else if( binding instanceof IProblemBinding ){
|
} else if( binding instanceof IProblemBinding ){
|
||||||
if( binding instanceof ICPPScope )
|
if( binding instanceof ICPPScope )
|
||||||
return (IScope) binding;
|
return (IScope) binding;
|
||||||
return new CPPScope.CPPScopeProblem( IProblemBinding.SEMANTIC_BAD_SCOPE, names[i-1].toCharArray() );
|
return new CPPScope.CPPScopeProblem( names[i-1], IProblemBinding.SEMANTIC_BAD_SCOPE, names[i-1].toCharArray() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( ((ICPPASTQualifiedName)parent).isFullyQualified() )
|
else if( ((ICPPASTQualifiedName)parent).isFullyQualified() )
|
||||||
|
@ -1481,7 +1481,7 @@ public class CPPVisitor {
|
||||||
return e.getProblem();
|
return e.getProblem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_TYPE, new char[0] );
|
return new ProblemBinding( binary, IProblemBinding.SEMANTIC_INVALID_TYPE, new char[0] );
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue