Commit Graph

279 Commits

Author SHA1 Message Date
Eike Ziller
69fa7a8ffb Merge remote-tracking branch 'origin/4.0' into 4.1
Conflicts:
	src/plugins/projectexplorer/runconfiguration.h
	tests/unit/unittest/unittest.pro

Change-Id: I3d327b1198df2a7e9268916af9624ce5d21195df
2016-06-28 11:42:03 +02:00
Nikolai Kosjar
05c1efd8ef Clang: Fix dot-arrow-correction for not-yet-parsed unsaved content
The issue was re-producible with e.g.:

    void g()
    {
        // Type 'foo.' as fast as possible in the next line

    }

This led to "foo->" with completion results as if there was no "foo." at
all in that line.

We relied on a correct position for
translationUnit.sourceLocationAtWithoutReparsing(), but the just typed
characters were not yet reparsed. And we do not want to reparse at that
point since takes too long. We already determine the utf8 position for
the dot character, so simply use that instead.

This completes commit 17c1325cc4.

Change-Id: I669888b5c17ee63b2aec7b16c9921f9d79e281f9
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-24 08:31:28 +00:00
Marco Bubke
cc804d542d UnitTests: Disable small string test
Change-Id: I508e43923efc065fce9a79edebeff79606069abd
(cherry picked from commit 505c9be9af)
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-06-23 12:39:14 +00:00
Nikolai Kosjar
438bd85b84 Clang: Fix updating revision number for all translation units
Change-Id: I1ad305ed081aecadde968e041f7b99a24a1c4784
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-06-23 06:29:14 +00:00
Nikolai Kosjar
b032038781 Clang: Tests: Use test data working with clang 3.6 *and* clang 3.8
The test data produces different results when it is run with libclang
3.6 and libclang 3.8. (lib)clang 3.8 will generate an error instead of a
warning and suppress further diagnostics. See below.

Use simpler test data that is agnostic to the different clang versions.

$ cat input.cpp
    class X {
	X(X&&) noexcept;
    };

    X::X(X&&) = default;

    int function()
    {
    }

$ clang++-3.6 -fsyntax-only -std=c++11 input.cpp
    input.cpp:5:4: warning: 'X' is missing exception specification 'noexcept'
    X::X(X&&) = default;
       ^
	      noexcept
    input.cpp:2:5: note: previous declaration is here
	X(X&&) noexcept;
	^
    input.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
    2 warnings generated.

$ clang++-3.8 -fsyntax-only -std=c++11 input.cpp
    input.cpp:5:4: error: 'X' is missing exception specification 'noexcept'
    X::X(X&&) = default;
       ^
	      noexcept
    input.cpp:2:5: note: previous declaration is here
	X(X&&) noexcept;
	^
    1 error generated.

Change-Id: I6d786a8b87eb4438fa8db36540db9358181b9a5b
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-22 12:39:39 +00:00
Eike Ziller
4f9016e03f Merge remote-tracking branch 'origin/4.0' into 4.1
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/android/android.qbs
	src/plugins/android/androiddevice.cpp
	src/plugins/autotest/testcodeparser.cpp
	src/plugins/debugger/analyzer/analyzerstartparameters.h
	src/plugins/projectexplorer/devicesupport/desktopdevice.cpp
	src/plugins/projectexplorer/devicesupport/idevice.cpp
	src/plugins/projectexplorer/runconfiguration.h

Change-Id: I2474d06f2309fa71210a8401846bc2ef85bebf1d
2016-06-22 11:09:32 +02:00
David Schulz
de0ceea956 Clang: Adjust mockup code to creator code.
Change-Id: I83c5b7c1af2ee4b77b2f3d8e06b54218838056f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-06-21 13:37:42 +00:00
David Schulz
8c7913e0ba Clang: Fix compiling unittest on windows.
Change-Id: Id48d494510ee53a9e888e22a752e8210f3d4ae2d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-06-21 13:37:35 +00:00
Marco Bubke
505c9be9af UnitTests: Disable small string test
There are some compiler problems and before I change the code I want to
investigate them deeper.

Change-Id: I497aa594fe0ea67be5927cc75bf6d64158952663
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-06-08 14:16:57 +00:00
Orgad Shaneh
aca8f9a731 UnitTest: Fix compilation
Change-Id: I4aa18c552bdfb8bb685e224b63c6080f25afa567
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-05-17 10:17:43 +00:00
Eike Ziller
9e66ce48e4 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/autotest/testcodeparser.cpp
	src/tools/clangbackend/ipcsource/clangbackendclangipc-source.pri
	tests/unit/unittest/unittest.pro

Change-Id: I9db4fbea6ea7c9fdd0d8e1703735af20c92e754b
2016-05-09 16:37:41 +02:00
Nikolai Kosjar
17c1325cc4 Clang: Fix dot to arrow correction
The position of the dot character was determined on an outdated
translation unit.

We queried the translation unit for the source location of the dot
character, but apparently clang_codeCompleteAt() does not update the
source locations for the translation unit. And we do not want to reparse
since this is expensive. Thus, determine the byte position manually by
scanning over the document until the right line/column is reached.

Change-Id: I25e256bb81a83bb71c7e46a0fb3e927bf4031b16
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-05-03 12:19:13 +00:00
Eike Ziller
0f94aa3f4d Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/projectwizardpage.cpp
	src/plugins/projectexplorer/xcodebuildparser.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp
	src/tools/clangbackend/ipcsource/translationunits.cpp

Change-Id: Ibf0857cf8dbf95fc9ac13d5c2112b3f4a2ca7de6
2016-05-03 11:49:01 +02:00
David Schulz
abeac62191 Fix building creator with the intel compiler.
Replacing all occurrences of win32-msvc* with msvc.

Task-number: QTCREATORBUG-16118
Change-Id: I46bd54628bffb04c24bca587fd9dd7684e888f1a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-26 12:32:54 +00:00
Nikolai Kosjar
7b7b1823cb Clang: Avoid parse loop if libclang crashed or file vanished
Remember whether clang_parseTranslationUnit() or
clang_reparseTranslationUnit() failed the last time and do not trigger
parse/reparse again.

Also, check whether the main file exists before reparsing.

Task-number: QTCREATORBUG-16051
Task-number: QTCREATORBUG-16140
Change-Id: Ied39e66a18032854911229898573941fe2ada35b
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-04-26 12:28:16 +00:00
Eike Ziller
4a826ada04 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: I0cbc9d335073e3234f472aa43f462eef9a9178aa
2016-04-22 15:13:58 +02:00
Nikolai Kosjar
11836a14cf Clang: Fix SOFT ASSERT: "!m_functionName.isEmpty()"
...that ocurred for e.g. "foo (<COMPLETE HERE>".

We did not handle the following cases:
 1) white space after the function name
 2) nothing before parenthesis

Change-Id: If6aedd2cc938df30516e13a860d07d7a509633ae
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-04-20 13:03:32 +00:00
Eike Ziller
ee8bf341c6 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/projectexplorer/session.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp

Change-Id: I6946139f5e5fa3a9cdbb322fd50be248e2c0133f
2016-04-20 14:58:48 +02:00
Nikolai Kosjar
211894d348 Clang: Tests: Fix compilation with clang-3.6 using stdlib
When using stdlib (default on Linux) and compiling with "-std=c++14", errors
like the following occurr. Avoid them by not requiring c++14.

  $ clang --version
  Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)
  Target: x86_64-pc-linux-gnu
  Thread model: posix

  $ cat clangtest.cpp
  #include <random>

  $ clang -std=c++11 -fsyntax-only clangtest.cpp # Fine with c++11/stdlibc++
  $ clang -std=c++14 -fsyntax-only clangtest.cpp # Ops with c++14/stdlibc++
  In file included from clangtest.cpp:1:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/algorithm:62:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:65:
  In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/random:39:
  /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
    using ::gets;
          ~~^
  1 error generated.
  $ clang -std=c++14 -stdlib=libc++ -fsyntax-only clangtest.cpp # Fine with c++14/libc++

See also https://llvm.org/bugs/show_bug.cgi?id=18402.

Change-Id: I2ab3ea837b80196b51d8816ee8aa26a4a531e939
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2016-04-19 12:01:59 +00:00
hjk
bd406e3cd0 Test: Fix typo in gmock detection message
Change-Id: I8c95b5279349b92f232c26f57ade91f5b51e3b55
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-04-18 11:14:06 +00:00
hjk
39a38d5679 Wholesale conversion to #pragma once
Kudos to cgmb and https://github.com/cgmb/guardonce

Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-30 15:20:19 +00:00
Marco Bubke
b2c8d76156 Utils: Add constructor for character pointer
Change-Id: I12bd787caf911502a666de2c324bb74b8bd7b0aa
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-08 11:50:30 +00:00
Marco Bubke
aa28f93fac Clang: Remove unused function
Change-Id: I40f04bf898a6370f1e4586c6f942337301b0407a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-07 14:07:07 +00:00
Marco Bubke
f8e64a87bb Clang: Add Declaration highlighting
We are adding declaration detection for function to the highligher on
user request. Other declaration will follow in separate patches.

Task-number: QTCREATORBUG-15564
Change-Id: I54e97c26425f8d6e9854547d50a9ac8fa076b4e8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-07 12:07:21 +00:00
Marco Bubke
2349b13ae5 Clang: Rename HighlightingInformation to HighlightingMark
Change-Id: I3954c7c9abe593ea04092337f48ac2b153e883ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-07 12:06:40 +00:00
Orgad Shaneh
d9a57623af Clang: Add some tests for lambda highlighting
Test that local, argument and member variables are highlighted
correctly when referenced inside a lambda

struct LambdaTester
{
    int member = 0;
    void func() {
        const int var = 42, var2 = 84;
        auto lambda = [var, this](int input) {
            return var + input + member; // All variables here
        };
        lambda(var2);
    }
};

Change-Id: I3b7b86c57a91f0f254715770dd870033be928b28
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-03-01 13:20:49 +00:00
Nikolai Kosjar
b2397b6b4f Clang: Ignore certain warnings in header files
We already had this workarounded, but it got lost in the refactorings.

Task-number: QTCREATORBUG-12067
Change-Id: Ie01f9d41f25d17d1b595204748634bc87ef44378
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-25 13:31:15 +00:00
Marco Bubke
c3a1355c34 UnitTests: Search for the google test in sibling directories too
Change-Id: I7f9c82e7f4a38a422b1df272f874c3525dfacd32
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-02-25 09:40:30 +00:00
Marco Bubke
e562af2c29 Utils: Rename isReference to isReadOnlyReference
There is implicit knowledge that the reference is read only in the code
so we should honor that and make is explicit.

Change-Id: I0d6eab6595ae1414ad2607760a2e02fd49bafd72
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-25 09:39:51 +00:00
Orgad Shaneh
0c575700cb Clang: Fix highlighting of variables in lambda capture
void func() {
    const int var = 42;
    auto lambda = [var](int input) { // var is not highlighted
        return var + input;
    };
}

Change-Id: I95a5732ab8391e1232894e419b081c729e2d1ba1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-02-22 15:38:42 +00:00
Marco Bubke
0f61908ab0 Utils: Add sized array
Sometimes you need a very small array which has a size and max size.
QVarLengthArray is simular but has some size and run time overhead and it
has no max size. It will instead malloc. So this array is for very small
collections under 256 values which never allocate and have only a size
overhead of a byte.

Change-Id: Ia392c750d566c4accc6077c3dc4d9d4ae501e599
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-22 14:53:12 +00:00
Marco Bubke
7912213894 UnitTests: Use fno-omit-frame-pointer for profiles
Perf is not producing reliable stack traces without.

Change-Id: I5f594d45b06a66d91b0c687937dd948d6c724c62
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-02-22 13:33:43 +00:00
Christian Stenger
bad4cb4896 Tests: Fix wrong license header
Introduced with b278dc87ca.

Change-Id: I595384b35e9e5f2f319ec4e9c1ad92f7fc4bdcd4
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-02-22 07:22:36 +00:00
Marco Bubke
1eb0c94f81 Utils: Add SmallString
SmallString is a very simple utf8 string class. It's purpose is performance.
It uses a short string opimization which provides 31 bytes of heap free
memory to save a 30 bytes long string plus null terminator. If the string
gets larger heap is allocated. The grow strategy is 1.5 to improve reuse
of allocated memory.

It uses optionally constexpr to provide string literals.

Change-Id: I7757fb51abfeca200d074cbfce2f1d99edc0ecb0
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-17 15:07:01 +00:00
Marco Bubke
7984e928d1 UnitTests: Rename CLANGBACKEND_TESTS in UNIT_TESTS
Change-Id: I26635a0c85edcc90cdffb93d3f9ae4ad4c8cb98e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-17 14:57:53 +00:00
Marco Bubke
f8884501c2 Clang: Add Google Benchmark unit tests
Change-Id: I5d137aebd3e94f5d2f867d8ec007973a827491ec
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-02-17 10:35:34 +00:00
Marco Bubke
b11c14808d Clang: Fix broken windows build
Change-Id: I51b696cbb04e50058ace92a3ead04e3655b0a2f6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-16 18:27:44 +00:00
Nikolai Kosjar
b064b06759 Clang: Display also child diagnostics in tooltips
...by introducing a custom tooltip widget for diagnostics.

Locations and fixits of child diagnostics are presented as clickable
links, leading to that position in the editor or to the execution of
that fix it.

Change-Id: I83e801e22d0421dd29275e333e5dd91587885cf1
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-02-12 11:54:09 +00:00
Nikolai Kosjar
9a4284d666 Clang: Use CppHoverHandler for diagnostic tooltips
We used to call QTextCharFormat::setToolTip from the ExtraSelection to
install the diagnostic tooltip. Since this allows to set only text
tooltips and we would like to introduce a custom tooltip widget for
diagnostics, make use of CppHoverHandler, which is more flexible.

Change-Id: Ia1b2c3c50810596ce4a3a025002e6e4efd8789db
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-02-12 11:20:27 +00:00
Marco Bubke
974070d2c8 Clang: Use MessageEnvelop instead of QVariant
QVariant has unwanted dependencies so we provided our own simpler solution.
We want to support move only types and calling the copy constructor as you
move the value in and outside. This copying is adding unwanted overhead
too.

Change-Id: I2e27a7924868efe81e8b8ff3415499c9fa22c2bc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-08 14:11:44 +00:00
Nikolai Kosjar
db8b9f9463 Clang: Fix variable name in test
Change-Id: Ief210920c62710786cf75fd6aea04897f4e2965e
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-02-01 15:17:11 +00:00
Nikolai Kosjar
57877cc14d Clang: Workaround dot detection for arrow correction
...by explicitly checking for the dot in the source.

Task-number: QTCREATORBUG-15654
Change-Id: I4172e88a7fbb3015ef391daf13ded1f0002aab9c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-02-01 12:20:58 +00:00
Nikolai Kosjar
da27ea4d42 Clang: Introduce UnsavedFile wrapper
This simplifies UnsavedFiles and makes TemporaryModifiedUnsavedFiles
useless.

Change-Id: I1896f971215ed22ce7aa7bf21b16381862b7469d
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-02-01 12:20:53 +00:00
Tobias Hunger
954569387c Update License according to agreement with Free Qt Foundation
* Update license information in tests directory

Change-Id: I311441dd37d053ca3175e44b284258e232ee93e0
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 16:01:06 +00:00
Eike Ziller
98257617e9 Merge remote-tracking branch 'origin/3.6'
Conflicts:
	src/plugins/clangcodemodel/clangassistproposalmodel.cpp
	src/plugins/clangcodemodel/clangassistproposalmodel.h

Change-Id: Iba30d2f4d95fa0f551afe58890d15f5835dfb715
2016-01-19 16:41:17 +01:00
Nikolai Kosjar
5691156b35 Clang: Fix inserting "::" after namespace
The extra "::" is showed in the tooltip right to the completion list
item, but it was not inserted.

Change-Id: I0ad2b816c56b8e3b5ccf0643f2c1a4f2a20b8818
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:37:10 +00:00
Nikolai Kosjar
2324db9d41 Clang: Fix html code in completion list item
E.g. "dynamic_cast&lt&gt;()" showed up as item.

Let CompletionChunksToTextConverter default to plain text format and
explicitly request HTML where needed.

Change-Id: Iebce85cb888a5bd697ffdce364118b6dc65a435d
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:37:06 +00:00
Nikolai Kosjar
a071e52b94 Clang: Extract duplicate code
Change-Id: I476916f825ab475f77f918127217dfc33eb4f388
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:27:55 +00:00
Nikolai Kosjar
8d6549fa74 Clang: Correct member access operator if possible
1 struct Foo { int member; };
 2 void f(Foo *foo)
 3 {
 4     foo.<REQUEST COMPLETION> // correct '.' to '->' and provide results
 5 }

The preferred approach would be to check if "foo" in line 4 is of
pointer type, but there is no suitable cursor (only CompoundStmt) at
that position since the code is usually not yet parsed and thus invalid.

Thus, just run the completion as is. If there are not any results for a
dot completion, re-run the completion with "." exchanged by "->". This
approach is inherently slower than the preferred approach implemented in
the built-in code model.

The following rare cases are not handled:

 1) Requesting completion after white space:
      Works: foo.<COMPLETE HERE>
      Fails: foo. <COMPLETE HERE>

 2) Opening a file and requesting completion (ctrl+space) without prior
    editing. No editing before triggering completion means that no
    unsaved file is generated on the backend side, which is a
    requirement for the correction.

Task-number: QTCREATORBUG-11581
Change-Id: I6bc8e8594778774ab342755fdb01a8a3e5c52ba0
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-01-19 13:20:35 +00:00
Oswald Buddenhagen
5a7d3e78db Merge remote-tracking branch 'origin/3.6'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: Ifbe181e86c161e082cc9a69a4bc7bd399f34ff47
2016-01-04 14:11:07 +01:00