mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
New parser fixes.
Remove NPE in consumeArrayModifiers(). Add stronger typing to bitfield expression in declarator().
This commit is contained in:
parent
fa0262f964
commit
cf15755c35
1 changed files with 8 additions and 5 deletions
|
@ -1587,7 +1587,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
List parameters = Collections.EMPTY_LIST;
|
List parameters = Collections.EMPTY_LIST;
|
||||||
List arrayMods = Collections.EMPTY_LIST;
|
List arrayMods = Collections.EMPTY_LIST;
|
||||||
boolean encounteredVarArgs = false;
|
boolean encounteredVarArgs = false;
|
||||||
Object bitField = null;
|
IASTExpression bitField = null;
|
||||||
boolean isFunction = false;
|
boolean isFunction = false;
|
||||||
overallLoop: do {
|
overallLoop: do {
|
||||||
|
|
||||||
|
@ -1720,7 +1720,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
else if (bitField != null) {
|
else if (bitField != null) {
|
||||||
IASTFieldDeclarator fl = createFieldDeclarator();
|
IASTFieldDeclarator fl = createFieldDeclarator();
|
||||||
fl.setBitFieldSize((IASTExpression) bitField);
|
fl.setBitFieldSize(bitField);
|
||||||
d = fl;
|
d = fl;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -1840,10 +1840,13 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
arrayMod = temp;
|
arrayMod = temp;
|
||||||
}
|
}
|
||||||
arrayMod.setConstantExpression( exp );
|
|
||||||
((CASTNode)arrayMod).setOffset( startOffset );
|
((CASTNode)arrayMod).setOffset( startOffset );
|
||||||
exp.setParent( arrayMod );
|
if( exp != null )
|
||||||
exp.setPropertyInParent( IASTArrayModifier.CONSTANT_EXPRESSION );
|
{
|
||||||
|
arrayMod.setConstantExpression( exp );
|
||||||
|
exp.setParent( arrayMod );
|
||||||
|
exp.setPropertyInParent( IASTArrayModifier.CONSTANT_EXPRESSION );
|
||||||
|
}
|
||||||
arrayMods.add( arrayMod );
|
arrayMods.add( arrayMod );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue