1. 18 Oct, 2020 3 commits
    • Igor Kushnir's avatar
      Merge branch '5.6' into master · f2e0a292
      Igor Kushnir authored
      f2e0a292
    • Igor Kushnir's avatar
      Optimize StatusbarProgressWidget::connectSingleItem() · ff1c26d4
      Igor Kushnir authored
      For each progress value report StatusBar::showProgress() calls
      ProgressItem::setUsesBusyIndicator(), which eventually results in a call
      to StatusbarProgressWidget::connectSingleItem(). The return value of
      ProgressManager::instance()->singleItem() changes very rarely between
      these calls. Let us avoid reconnecting the same signal/slot pair
      repeatedly.
      ff1c26d4
    • Igor Kushnir's avatar
      Don't show a busy indicator for 5s after a task completion · 0d87cab9
      Igor Kushnir authored
      81220db1 eliminated such misleading
      progress reports for items that use a busy indicator themselves, but
      missed the case when a quick percent-progress-reporting task follows
      right after a busy-indicator task.
      
      For example, GrepJob's WorkCollectFiles step uses a busy indicator, then
      its next WorkGrep step reports progress in percents. So when the
      WorkGrep step is completed in less than a second (e.g. when there are
      not many files to search in and the looked-for string is not present in
      any of them), the bottom-right-corner progress bar shows
      a busy indicator for 5 seconds.
      
      Let us display 100% progress during these 5 seconds instead.
      0d87cab9
  2. 17 Oct, 2020 16 commits
  3. 16 Oct, 2020 7 commits
    • Igor Kushnir's avatar
      static_assert that ProjectFile is nothrow-movable · 82ded4ca
      Igor Kushnir authored
      Efficient moving of ProjectFile is important for
      ProjectFileDataProvider's performance.
      
      GIT_SILENT
      82ded4ca
    • Igor Kushnir's avatar
      Make TypePtr and DUChainPointer nothrow-movable · 6d1ee86d
      Igor Kushnir authored
      The user-declared copy constructors and copy assignment operators
      prevented compiler from generating noexcept move constructors and move
      assignment operators for these two class templates. Eliminating the
      declarations of copy operations to follow the rule of zero is impossible
      or at least confusing, because of other constructors and assignment
      operators in the two class templates. Let us default the move operations
      instead to improve performance.
      
      DUChainPointer(const DUChainPointer& rhs) was not defaulted, but did
      exactly what the defaulted copy constructor would do as d is the only
      DUChainPointer's data member. Let us make this more obvious by
      defaulting this copy constructor.
      6d1ee86d
    • Igor Kushnir's avatar
      Make KDevelop::Path nothrow-movable · ae08eb3b
      Igor Kushnir authored
      The pseudo-copy constructor, the defaulted copy assignment operator and
      destructor prevented compiler from generating noexcept move constructor
      and move assignment operator. Eliminating them follows the rule of zero
      and lets the compiler generate efficient default operations.
      
      Path(const Path& base, const QString& subPath = QString()) acts as an
      inefficient copy constructor. When only one Path argument is passed to
      this constructor, the only effect is in the member initializer list:
      `: m_data(other.m_data)`. This is exactly what the defaulted copy
      constructor would do as m_data is the only Path's data member. But the
      compiler-generated copy constructor is faster, because it is inline and
      it doesn't perform various checks on subPath.
      
      This should improve performance in many places. For example, it makes
      ProjectFileDataProvider::projectOpened() and
      ProjectFileDataProvider::projectClosing() somewhat faster.
      ae08eb3b
    • Igor Kushnir's avatar
      26099129
    • Igor Kushnir's avatar
      Don't call a virtual function twice in a row · 10293667
      Igor Kushnir authored
      GIT_SILENT
      10293667
    • Igor Kushnir's avatar
      Fix a new test_documentcontroller test failure · 60ffbc7c
      Igor Kushnir authored
      300ea014 introduced
      DocumentControllerPrivate::shuttingDown variable. It is set to false in
      constructor and to true in DocumentController::cleanup(). However
      TestDocumentController::init() calls DocumentController::initialize()
      before each test function; TestDocumentController::cleanup() calls
      DocumentController::cleanup() after each test function. So the second
      test function fails to open a document after shutdown.
      
      Let us set DocumentControllerPrivate::shuttingDown to false in
      DocumentController::initialize() to fix the test failure.
      60ffbc7c
    • Igor Kushnir's avatar
      Merge branch '5.6' into master · 3be6bccb
      Igor Kushnir authored
      3be6bccb
  4. 15 Oct, 2020 14 commits
    • Milian Wolff's avatar
      Fix memory leaks in test_templateclassgenerator · f2c598b1
      Milian Wolff authored
      Use std::unique_ptr to prevent the leaks.
      f2c598b1
    • Milian Wolff's avatar
      Use C++17 to compile KDevelop · f2925b5c
      Milian Wolff authored
      Fix the (broken) usage of operator++ in test_kdevhash to make it
      compile. Just flip/flop between the values instead.
      f2925b5c
    • Friedrich W. H. Kossebau's avatar
    • Friedrich W. H. Kossebau's avatar
    • Friedrich W. H. Kossebau's avatar
      d20d145f
    • Milian Wolff's avatar
      Unbreak test_qmljscompletion · 49fd064a
      Milian Wolff authored
      Do not expect QtQuick 1.0 by default, that's long deprecated.
      Furthermore, improve the module code completion by listing all
      library paths.
      49fd064a
    • Milian Wolff's avatar
      Fix test_gdbprinters by making it more resilient · bc5a7cd6
      Milian Wolff authored
      Don't rely on `next` bringing us to the expected line. Instead,
      request the line explicitly and continue until we land there.
      Apparrently some compiler change triggered a failure of the
      test then otherwise, as we ended up in the A::A ctor in line 11
      while we actually wanted to print the pointerList in loc 46.
      bc5a7cd6
    • Milian Wolff's avatar
      Fix UB due to accessing partially destroyed Document · 6a5ccb13
      Milian Wolff authored
      Fixes UBSAN warning:
      ```
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/document.cpp:73:70: runtime error: downcast of address 0x6030000bcd40 which does not point to an object of type 'Document'
      0x6030000bcd40: note: object is of type 'QObject'
       24 00 00 18  e0 a4 64 8d 8a 7f 00 00  a0 52 03 00 80 60 00 00  d0 5b 09 00 40 60 00 00  d0 d1 00 00
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'QObject'
          #0 0x7f8a8f5e99d5 in operator() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/document.cpp:73
          #1 0x7f8a8f5e99d5 in call /usr/include/qt/QtCore/qobjectdefs_impl.h:146
          #2 0x7f8a8f5e99d5 in call<QtPrivate::List<QObject*>, void> /usr/include/qt/QtCore/qobjectdefs_impl.h:256
          #3 0x7f8a8f5e99d5 in impl /usr/include/qt/QtCore/qobjectdefs_impl.h:443
          #4 0x7f8a8d3eb035  (/usr/lib/libQt5Core.so.5+0x2eb035)
          #5 0x7f8a8d3e427f in QObject::destroyed(QObject*) (/usr/lib/libQt5Core.so.5+0x2e427f)
          #6 0x7f8a8d3e9356 in QObject::~QObject() (/usr/lib/libQt5Core.so.5+0x2e9356)
          #7 0x7f8a8f5ebf91 in Sublime::Document::~Document() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/document.cpp:76
      ```
      6a5ccb13
    • Milian Wolff's avatar
      Fix UB due to casting partially destroyed View · a59dad52
      Milian Wolff authored
      Fixes UBSAN warning:
      ```
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/document.cpp:91:72: runtime error: downcast of address 0x60300038b6f0 which does not point to an object of type 'View'
      0x60300038b6f0: note: object is of type 'QObject'
       22 00 80 03  e0 c4 ad 14 57 7f 00 00  a0 fa 1a 00 80 60 00 00  50 b7 38 00 30 60 00 00  00 00 00 00
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'QObject'
          #0 0x7f5716a8026e in operator() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/document.cpp:91
          #1 0x7f5716a8026e in call /usr/include/qt/QtCore/qobjectdefs_impl.h:146
          #2 0x7f5716a8026e in call<QtPrivate::List<QObject*>, void> /usr/include/qt/QtCore/qobjectdefs_impl.h:256
          #3 0x7f5716a8026e in impl /usr/include/qt/QtCore/qobjectdefs_impl.h:443
          #4 0x7f571487d035  (/usr/lib/libQt5Core.so.5+0x2eb035)
          #5 0x7f571487627f in QObject::destroyed(QObject*) (/usr/lib/libQt5Core.so.5+0x2e427f)
          #6 0x7f571487b356 in QObject::~QObject() (/usr/lib/libQt5Core.so.5+0x2e9356)
          #7 0x7f5716b351b2 in Sublime::View::~View() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/view.cpp:60
      ```
      a59dad52
    • Milian Wolff's avatar
      Fix UB when trying to up-cast partially destroyed Area · 830f3c17
      Milian Wolff authored
      Fixes UBSAN report:
      ```
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/area.cpp:158:66: runtime error: downcast of address 0x6030000bd7f0 which does not point to an object of type 'Area'
      0x6030000bd7f0: note: object is of type 'QObject'
       2f 00 00 7b  e0 a4 1c 83 62 7f 00 00  20 59 03 00 80 60 00 00  00 df 00 00 b0 60 00 00  00 00 00 00
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'QObject'
          #0 0x7f628507ca99 in operator() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/area.cpp:158
          #1 0x7f628507ca99 in call /usr/include/qt/QtCore/qobjectdefs_impl.h:146
          #2 0x7f628507ca99 in call<QtPrivate::List<QObject*>, void> /usr/include/qt/QtCore/qobjectdefs_impl.h:256
          #3 0x7f628507ca99 in impl /usr/include/qt/QtCore/qobjectdefs_impl.h:443
          #4 0x7f6282f6b035  (/usr/lib/libQt5Core.so.5+0x2eb035)
          #5 0x7f6282f6427f in QObject::destroyed(QObject*) (/usr/lib/libQt5Core.so.5+0x2e427f)
          #6 0x7f6282f69356 in QObject::~QObject() (/usr/lib/libQt5Core.so.5+0x2e9356)
          #7 0x7f6285096fcb in Sublime::Area::~Area() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/area.cpp:161
          #8 0x7f628509815e in Sublime::Area::~Area() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/area.cpp:161
          #9 0x56049f3ba6c5 in TestAreaOperation::cleanup() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/sublime/tests/test_areaoperation.cpp:144
      ```
      830f3c17
    • Milian Wolff's avatar
      Fix memory leak in QTest::toString(KDevelop::DocumentRange) · 0beaacae
      Milian Wolff authored
      Free the raw string we get when we call QTest::toString on the
      KTextEditor::Range internally.
      
      Fixes LSAN warning:
      ```
      Direct leak of 76 byte(s) in 4 object(s) allocated from:
          #0 0x7f1cde10b0c1 in operator new[](unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:102
          #1 0x7f1cc5d2d518 in qstrdup(char const*) (/usr/lib/libQt5Core.so.5+0x124518)
          #2 0x7f1cc7eace1d in char* QTest::toString<KTextEditor::Range>(KTextEditor::Range const&) /home/milian/projects/kf5/src/frameworks/ktexteditor/src/utils/range.cpp:105
          #3 0x559204f76e07 in char* QTest::toString<KDevelop::DocumentRange>(KDevelop::DocumentRange const&) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/editor/documentrange.h:66
      ```
      
      While at it, use QByteArray::fromRawData too.
      0beaacae
    • Milian Wolff's avatar
      Fix UB due to excessive shift exponent in EmbeddedTreeRemoveItem · 9f80ae15
      Milian Wolff authored
      Fixes UBSAN warning:
      
      ```
      QWARN  : TestProblems::cleanupTestCase()      1.561 ?[31mwarning: KDevelop::EmbeddedTreeRemoveItem::newItemCount[/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/util/embeddedfreetree.h:814]?[0m: 77 VS 32
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/util/embeddedfreetree.h:816:17: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
      ```
      9f80ae15
    • Milian Wolff's avatar
      Fix UBSAN reports when QApplication was requested in GUILESS tests · 986e19d7
      Milian Wolff authored
      Use QCoreApplication instead
      986e19d7
    • Milian Wolff's avatar
      Don't let clang-format sort includes · e8987f58
      Milian Wolff authored
      Without this setting, one cannot use a clang-format pre-commit
      hook, as it would frequently pull in unrelated changes. We should
      fix the sorting once in the whole code base and then re-enable
      this setting eventually.
      e8987f58