Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-9799

TranslationUnit returns line numbers off-by-one when the preprocessor is not used.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P2: Important P2: Important
    • None
    • Qt Creator 2.8.0
    • C/C++/Obj-C++ Support
    • None

      When the parser is run on non-preprocessed input, the line numbers that are returned by TranslationUnit::getPosition (and related methods) is 1 lower than the actual line number.

      The reason is that the PPLine stores the start of the #line directives, while the _lineOffsets store the end. However, this off-by-one is pervasively corrected, esp. in the places where there are generated tokens.

      See also tst_AST::line_and_column_1()

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kosjar Nikolai Kosjar
            erikv Erik Verbruggen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes