1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

file names in problem bindings, and don't report type problems if nothing was found

This commit is contained in:
Andrew Niefer 2005-04-06 18:15:54 +00:00
parent 3119b13099
commit c739209ea0
2 changed files with 10 additions and 4 deletions

View file

@ -17,8 +17,10 @@ package org.eclipse.cdt.internal.core.dom.parser;
import java.text.MessageFormat; import java.text.MessageFormat;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
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.IASTNodeLocation;
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.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -83,7 +85,9 @@ public class ProblemBinding implements IProblemBinding, IType, IScope {
msg = MessageFormat.format(msg, new Object[] { new String(arg) }); msg = MessageFormat.format(msg, new Object[] { new String(arg) });
} }
Object[] args = new Object[] { msg, new String("") /*file*/, new Integer(0) /*line*/}; //$NON-NLS-1$ IASTNodeLocation [] locs = node.getNodeLocations();
IASTFileLocation fileLoc = node.getTranslationUnit().flattenLocationsToFile( locs );
Object[] args = new Object[] { msg, fileLoc.getFileName(), new Integer(-1) }; //$NON-NLS-1$
message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args); message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
return message; return message;
} }

View file

@ -462,9 +462,11 @@ public class CPPSemantics {
} }
} }
if( binding != null ) {
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( data.astName, 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 ) ){
if( data.forDefinition() ){ if( data.forDefinition() ){