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:
parent
3119b13099
commit
c739209ea0
2 changed files with 10 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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() ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue