-
Notifications
You must be signed in to change notification settings - Fork 19
Description
This issue was copied from checkedc/checkedc-clang#17
This change addresses issue #7 (process bounds expressions for parameters
with all the parameters available). Currently, bounds expressions for
parameters are being parsed and type checked in the scope of the parameters
seen so far in a parameter list. They need to be typechecked in a scope with
all the parameters for the parameter list.
To do this, parsing and type checking of bounds expressions for parameters
is deferred until the entire parameter list has been seen. This is done
in two steps. During the initial parse, the tokens for a superset of bounds
expressions are parsed and stored in a list. They are then re-parsed using
ParseBoundsExpression after all parameters have been seen.
This change also improves error messages when a bounds expression is parsed
with misspelled contextual keyword. For example, int x : boounds(x, x + 5).
Before, the code would simply give up after parsing the misspelled keyword
and the '('. This led to additional error messages when the code tried to
match the closing ')'. This fix is to skip all the tokens up to but not
including the closing ')'.
Testing:
- Passes existing clang test suite.
- Added additional tests for parsing of function parameter lists with bounds
expressions. This will be committed separately to the Checked C repo.