|
1 | | -.. Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com> |
2 | | - Copyright 2011, 2012 Red Hat, Inc. |
| 1 | +.. Copyright 2011-2012, 2017 David Malcolm <dmalcolm@redhat.com> |
| 2 | + Copyright 2011-2012, 2017 Red Hat, Inc. |
3 | 3 |
|
4 | 4 | This is free software: you can redistribute it and/or modify it |
5 | 5 | under the terms of the GNU General Public License as published by |
@@ -510,49 +510,3 @@ Global data access |
510 | 510 | :py:class:`gcc.QualUnionType`, along with a string `name`, look for a |
511 | 511 | field with that name within the given struct or union, returning it as a |
512 | 512 | :py:class:`gcc.FieldDecl`, or None if it wasn't found |
513 | | -
|
514 | | -
|
515 | | -Working with source code |
516 | | -======================== |
517 | | -
|
518 | | -.. py:function:: gccutils.get_src_for_loc(loc) |
519 | | -
|
520 | | - Given a :py:class:`gcc.Location`, get the source line as a string |
521 | | - (without trailing whitespace or newlines) |
522 | | -
|
523 | | -.. py:class:: gcc.Location |
524 | | -
|
525 | | - Wrapper around GCC's `location_t`, representing a location within the source |
526 | | - code. Use :py:func:`gccutils.get_src_for_loc` to get at the line of actual |
527 | | - source code. |
528 | | -
|
529 | | - The output from __repr__ looks like this:: |
530 | | -
|
531 | | - gcc.Location(file='./src/test.c', line=42) |
532 | | -
|
533 | | - The output from__str__ looks like this:: |
534 | | -
|
535 | | - ./src/test.c:42 |
536 | | -
|
537 | | - .. py:attribute:: file |
538 | | -
|
539 | | - (string) Name of the source file (or header file) |
540 | | -
|
541 | | - .. py:attribute:: line |
542 | | -
|
543 | | - (int) Line number within source file (starting at 1, not 0) |
544 | | -
|
545 | | - .. py:attribute:: column |
546 | | -
|
547 | | - (int) Column number within source file (starting at 1, not 0) |
548 | | -
|
549 | | - .. py:attribute:: in_system_header |
550 | | -
|
551 | | - (bool) This attribute flags locations that are within a system header |
552 | | - file. It may be of use when writing custom warnings, so that you |
553 | | - can filter out issues in system headers, leaving just those within |
554 | | - the user's code:: |
555 | | -
|
556 | | - # Don't report on issues found in system headers: |
557 | | - if decl.location.in_system_header: |
558 | | - return |
0 commit comments