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

Clang: Highlighting issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 3.6.0-rc1
    • C/C++/Obj-C++ Support
    • None

      This is for https://codereview.qt-project.org/#/c/138326/.

      Collected highlighting issues:

      main.cpp
      // --- Include directives ----------------------------------------------------
      
      #include "/usr/include/zlib.h" // OK
      #include </usr/include/zlib.h> // OPS, "</usr/include/zlib.h>" has preprocessor format
      #include <QtGlobal> // ...here too
      #include <QVector> // ...here too
      
      
      // --- Macro -----------------------------------------------------------------
      
      // HMM, that's different to build in code model: macro definition text has also preprocessor format
      #define OBJECT_LIKE_MACRO 1
      #define FUNCTION_LIKE_MACRO(x) (x+1) \
          + (x+2)
      
      void f()
      {
          OBJECT_LIKE_MACRO; // OPS, macro use not in preprocessor format
          FUNCTION_LIKE_MACRO(1); // OPS, macro use not in preprocessor format
      }
      
      void g()
      {
          QVector<int> ints;
          foreach (int i, ints) { // OPS, no formats for macro arguments (other: QTC_ASSERT)
              ++i;
          }
      }
      
      
      // --- Enums & Fields --------------------------------------------------------
      
      enum Kind : quint32 { // OPS, "quint32" has also enum format. Should be type.
          Other = 0,
      };
      
      // --- Enums & Fields --------------------------------------------------------
      
      struct Muu {
          void update();
      };
      
      // --- Casts ----------------------------------------------------------------
      
      void c()
      {
          static_cast<void (Muu::*)()> // OPS, "Muu" not in type format
                  (&Muu::update); // OK, here it's fine
      }
      
      // --- Q_DECLARE_FLAGS(ItemFlags, ItemFlag) ----------------------------------
      
      Qt::ItemFlags y(); // OPS, "ItemFlags" not in type format (typedef coming from macro).
      
      // --- Lambdas -------------------------------------------------------------
      
      void xc()
      {
          int line, column;
          auto l = [line, column]() { // OPS, "line" and "column" not in local format
              return line + column;
          };
      }
      
      
      // --- Typedefs --------------------------------------------------------------
      
      using IntFromUsing = int; // OPS, "IntFromUsing" not in type format
      typedef int IntFromTypedef; // OPS, "IntFromTypedef" not in type format
      IntFromTypedef i; // OPS, "IntFromTypedef" not in type format
      IntFromUsing j; // OPS, "IntFromUsing" not in type format
      
      
      // --- Friends ---------------------------------------------------------------
      
      class Foo
      {
      public:
          friend class FooPrivate; // OPS, "FooPrivate" not in type format
          friend bool operator==(const Foo &first, const Foo &second); // OPS, no formats for parameter list
      };
      
      struct FooPrivate {};
      
      
      // --- Members in member initialization list ---------------------------------
      
      class Hello
      {
      public:
          Hello() : member(0) // OPS, "member" not in field format
          {}
      
          int member;
      };
      
      
      // --- Templates -------------------------------------------------------------
      
      template <typename C>
      void templateFunction(C c) // OPS, "templateFunction" not in function format
      {
          c.begin(); // OPS, "begin" not in function format
      }
      
      template <typename X>
      class MyContainer {}; // OPS, "MyContainer" not type format
      
      template <>
      class MyContainer<Foo> {}; // OK, fine for specialization.
      
      
      
      
      int main() { return 0; }
      

        For Gerrit Dashboard: QTCREATORBUG-15271
        # Subject Branch Project Status CR V

            kosjar Nikolai Kosjar
            kosjar Nikolai Kosjar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes