You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tries to get the 'lineno' attribute from p.slice[1] that isn't there so getattr() will return the default value of 0 instead of the actual line number.
I figured out that p.slice[2] contains the appropriate 'lineno' attribute. Changing the last param of the Asm constructor calls from
coord=self._coord(p.lineno(1)))
to
coord=self._coord(p.lineno(2)))
makes the code to return correct file:line position for Asm nodes. Coord.column seems often to be set to None while pycparser fills it with meaningful values.
Would you kindly verify whether that simply fix is okay?
I cannot provide any test case right now because it would require a file with several lines. I confirm that the above mentioned fix works for several real-world C sources I fed in so far.
The text was updated successfully, but these errors were encountered:
As the title says, the line number in the Coord object is always set to 0 for Asm nodes. This happens because lineno in the following lines
pycparserext/pycparserext/ext_c_parser.py
Line 300 in b602b4d
pycparserext/pycparserext/ext_c_parser.py
Line 306 in b602b4d
pycparserext/pycparserext/ext_c_parser.py
Line 313 in b602b4d
pycparserext/pycparserext/ext_c_parser.py
Line 320 in b602b4d
tries to get the 'lineno' attribute from p.slice[1] that isn't there so getattr() will return the default value of 0 instead of the actual line number.
I figured out that p.slice[2] contains the appropriate 'lineno' attribute. Changing the last param of the Asm constructor calls from
coord=self._coord(p.lineno(1)))
to
coord=self._coord(p.lineno(2)))
makes the code to return correct file:line position for Asm nodes. Coord.column seems often to be set to None while pycparser fills it with meaningful values.
Would you kindly verify whether that simply fix is okay?
I cannot provide any test case right now because it would require a file with several lines. I confirm that the above mentioned fix works for several real-world C sources I fed in so far.
The text was updated successfully, but these errors were encountered: