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

Code model gets confused by qLastIndexOf in qstring.cpp

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 5.0.0-beta1
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Steps to reproduce:

      1. open qtbase's CMakeLists.txt (it happened in Qt 5 too)
      2. open qstring.cpp
      3. locate the declaration of qLastIndexOf, around line 150
      4. modify the code as follows:
        // internal
        qsizetype qFindStringBoyerMoore(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs);
        static inline qsizetype qFindChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs) noexcept;
        void f()
        { 
        }
        template <typename Haystack>
        static inline qsizetype qLastIndexOf(Haystack haystack, QChar needle, qsizetype from, Qt::CaseSensitivity cs) noexcept;
        void g()
        { 
        }
        template <>
        inline qsizetype qLastIndexOf(QString haystack, QChar needle,
                                      qsizetype from, Qt::CaseSensitivity cs) noexcept = delete; // unwanted, would detach
        

      If you move your cursor to the "f" function, the function locator at the top shows "f":
      Screenshot_20210414_140832.png

      If you then move the cursor to g, the locator shows nothing:
      Screenshot_20210414_141050.png

      The locator is a symptom of a larger problem, in which the contents of qstring.cpp between the declaration of qLastIndexOf (around line 150) and its definition (around line 10237) are improperly parsed. Some functionality works and some doesn't. That's over 95% of qstring.cpp, arguably one of the most important files in Qt.

        Attachments

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

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes