[Qt-creator] FindMethodDefinitionInsertPoint::operator() Bug

Erik Verbruggen erik.verbruggen at digia.com
Thu May 30 15:07:21 CEST 2013


On 29-5-2013 17:50, Lorenz Haas wrote:
> Hi,
>
> FindMethodDefinitionInsertPoint, operator(): The default position is set
> to the end of a file via
>
> _bestToken.maybeSet(-1, translationUnit()->ast()->lastToken());
>
> Unfortunately this fails if the file behind translationUnit() only
> contains #includes, since they seem to be not parsed in AST.
>
> Since translationUnit() is already parsed
> translationUnit()->firstSourceChar() is not really useful to get the
> content of the file in order to determine the last insert position. The
> only ways I came up with is a additional parameter or QFile +
> translationUnit()->fileName() but that is surely not sophisticated...
>
> Any help/suggestion, please, need that working for an other fix.

It's a bug Jim, but not as you know it.

Fix is at https://codereview.qt-project.org/57554

With that patch, you should be able to use the last token from an empty 
translation unit (that will be the T_EOF_SYMBOL), and have it point to 
the correct line number.

-- Erik.




More information about the Qt-creator mailing list