mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed Bug 93114 - [Parser] ClassCastException found in CPPASTProblem#getMessage() due to LocationMap$MacroExpansionLocation
This commit is contained in:
parent
7c6f79c6bc
commit
027dc8cb93
1 changed files with 12 additions and 3 deletions
|
@ -272,12 +272,21 @@ public class CPPASTProblem extends CPPASTNode implements IASTProblem {
|
||||||
IASTNodeLocation [] locs = getNodeLocations();
|
IASTNodeLocation [] locs = getNodeLocations();
|
||||||
String file = null;
|
String file = null;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
if( locs != null && locs.length > 0 ){
|
if( locs != null && locs.length == 1 && locs[0] instanceof IASTFileLocation ){
|
||||||
file = ((IASTFileLocation) locs[0]).getFileName();
|
file = ((IASTFileLocation) locs[0]).getFileName();
|
||||||
offset = locs[0].getNodeOffset();
|
offset = locs[0].getNodeOffset();
|
||||||
} else {
|
} else {
|
||||||
file = ""; //$NON-NLS-1$
|
IASTFileLocation f = getTranslationUnit().flattenLocationsToFile(locs);
|
||||||
offset = 0;
|
if( f == null )
|
||||||
|
{
|
||||||
|
file = ""; //$NON-NLS-1$
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = f.getFileName();
|
||||||
|
offset = f.getNodeOffset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Object[] args = new Object[] { msg, file, new Integer(offset) }; //$NON-NLS-1$
|
Object[] args = new Object[] { msg, file, new Integer(offset) }; //$NON-NLS-1$
|
||||||
message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args);
|
message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args);
|
||||||
|
|
Loading…
Add table
Reference in a new issue