Commit Graph

4400 Commits

Author SHA1 Message Date
Nikolai Kosjar
a10bfb8400 CppTools: Do not hardcode default language version
...instead, use the latest we support.

Change-Id: I7e7768bc4bc31de1fe0f441c03f3ab5d677d76e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:09 +00:00
Nikolai Kosjar
602ad72d42 CppTools: Refactor ProjectPartBuilder
...and add some basic tests.

Introduce the abstractions ProjectInterface and ToolChainInterface in
order to break the dependency to the ProjectExplorer. Also, some simple
logic can go there to simplify the (Base)ProjectPartBuilder.

Change-Id: I6c50a1804ce62098b87109931eb171f5c2542937
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:04 +00:00
Tim Jenssen
1898ba5ad3 make library defines more consistency
Change-Id: I211d511667d5b9c8f518bfbe750aca4483baff62
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-12-12 14:48:34 +00:00
Nikolai Kosjar
3a369552c6 CppTools: Classify ambiguous headers depending on other files
This applies for all project managers, except qmake. The qmake project
manager will make use of this in follow up changes.

Before, "foo.h" was always recognized as a CXXHeader. Now, it depends on
the other files. E.g. in a file list {"foo.h", "foo.c"} foo.h is now a
CHeader. In {"foo.h", "foo.c", "bar.cpp"} the file "foo.h" is ambiguous
and we will create two project parts, one where it is a CHeader, the
other where it is a CXXHeader.

Change-Id: I50505163368742584b1380c284d42cbe07cb4fc9
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-12 13:49:09 +00:00
Eike Ziller
c175f1e62f Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/plugins/ios/iosdevice.cpp
	src/plugins/ios/iossimulator.cpp
	src/plugins/projectexplorer/projectwindow.cpp
	src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
	src/shared/qbs

Change-Id: Ie98e2401a2259903141a13170c78388f2da467d2
2016-12-09 12:42:01 +01:00
Marco Bubke
542c730b33 Clang: Suppress unused parameter warnings in clang headers
Change-Id: I8b2d50be5bda75b6759b7ce73b9d37b2500f3efc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-08 11:57:35 +00:00
Marco Bubke
e0ca3be406 Clang: Fix test
Fix corresponding project file types.

Change-Id: I8758e90a2d0e3cf877b5c4bf72d91fb63f8a7f8b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:41:08 +00:00
Marco Bubke
3070a28422 Clang: Filter generated files
Generated files are not available, so clang will stop with an fatal error.

Change-Id: I80754015a1daf48cbf2ce8e06526c75b05b2901c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:41:01 +00:00
Marco Bubke
15de02ea0c Clang: Add refactoring support for unsaved content
We need the generated UI header but we don't have a build directory. So we
provide clang with in memory represations of the file.

Change-Id: Ie9db97bbea2222b0203a0457baa1f1fc7ad97213
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:39:11 +00:00
Marco Bubke
f02dddb6c8 Clang: Add flag to disable Clang LibTooling
Because of C++ linking problems we introduce QTC_NO_CLANG_LIBTOOLING as a
workaround to disable Clang LibTooling. Use QTC_NO_CLANG_LIBTOOLING=something
to disable it.

Change-Id: I2dc9947d69d94292e08dacb1558bef56f5ebbbe3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:38:37 +00:00
Christian Stenger
edc55eb7df UnitTest: Fix compile with gcc 4.8
Change-Id: Id620b803bfff7b677d7552c1a7e9aba78e17802f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-12-07 05:38:46 +00:00
hjk
e351c693c6 Debugger: Add a test to check the automatic expansion of 'this'
Change-Id: I90fad62442d677ba441e2e61b660cae7ebea52ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-06 06:16:08 +00:00
Marco Bubke
b8e391e5f0 Utils: Fix SmallString reserve for read only references
The capacity of a real only reference is zero but the size is larger than
zero. So if we reserve memory the new capacity has to be bigger than the
size and the capacity.

Change-Id: I8b423da7e7c1cf7cee081d1b3f3464b6fb3f67cf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-05 13:59:56 +00:00
Eike Ziller
8f0ddff1cc Merge remote-tracking branch 'origin/4.2'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/shared/qbs

Change-Id: I5050baa31f4a892d00cd6f7e088d1b597921474d
2016-12-05 10:55:35 +01:00
hjk
2275d68373 Debugger: Switch on QObject name display by default
... and use the option to govern general QObject guts display.

This allows people to completely avoid the performance impact
of attempted QObject display and still makes the feature
more prominent for our favorite use case.

Change-Id: I1e53b6448f646ab7eea9168a3cd24c77769e6328
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-02 11:23:46 +00:00
hjk
87e1093d59 Debugger: Fix QStandardItem test with namespaced Qt
Change-Id: I610dfddd519057c5464d89f42508108c7f8abb14
Reviewed-by: hjk <hjk@qt.io>
2016-12-01 15:28:24 +00:00
Christian Kandeler
6a03705c27 qbs build: Fix one more relative path
Change-Id: If8ad1fd77b3f79a23cb46addf56a91465d530057
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-12-01 14:42:31 +00:00
hjk
a7fb4cd3ed Debugger: Make QStandardItem dumper work without debug info
Change-Id: Iccdc693616558d2d224c1145eee78f903792c4a6
Task-number: QTCREATORBUG-16908
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-01 14:30:37 +00:00
hjk
c944d08702 Debugger: Make {boost,std}::shared_ptr display more compact
After debugging through a code base that makes extensive use
of shared pointers (LLDB...) I came to the conclusion that the
display of weak and strong counts is pretty much useless and
it would be better to avoid that level in the display.

Change-Id: Ie03b05fff4f7f5b7dced2e656b404e8e7938cc25
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-01 07:50:23 +00:00
hjk
53022f01fd Debugger: Add dumper for std::once_flag
Change-Id: I8b5166fc0e7d54676b84a1b0d45c6a2793c2a37c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-01 07:09:00 +00:00
Marco Bubke
b888520598 Utils: Reserve in smallstring was flaky
We have to copy the content of SmallString before we instantiate a new
constructor in the same memory. So the content to which data() is pointing
can be already invalid.

Change-Id: I3a0ab4f9ac0c1219c2bd75fc4412eaf56209ca64
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-30 15:32:48 +00:00
Eike Ziller
e487b3bd55 Merge remote-tracking branch 'origin/4.2'
Change-Id: I575f1cf98f2a4740577cdd94da21687d3392cdb7
2016-11-30 15:09:11 +01:00
hjk
3193321532 Debugger: Add a dumper for std::weak_ptr
Change-Id: I253b6d8069ecf36618aa40038da6820f52eb38df
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-30 13:37:46 +00:00
Marco Bubke
99efc96b63 UnitTest: Strip the carriage returns in IsSourceRangeWithText
The source code can be multi line which would contains end lines. Windows
endline contains '\r' which are not present under unix. To unify the test
we simply remove the 'r'.

Change-Id: Icf78b5188c9a4801ec13e455a49a069b20c64e97
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-28 16:48:57 +00:00
Marco Bubke
dca3410ee8 UnitTest: Use the os temp dir instead of a hard coded "/tmp"
Change-Id: Ief32d3ca9aa0ccee25a1415f84552117c7323a31
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-28 16:48:45 +00:00
Marco Bubke
600b85defa Utils: Add carriage return strip method to SmallString
Sometimes you want to compare unix and windows texts in tests. This is a
convenient function to remove the carriage returns.

Change-Id: I164298b70d3d775dd45903ea3753ac0e68ed2fdc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-28 16:48:25 +00:00
Orgad Shaneh
7b3642cce4 Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
2016-11-28 15:27:51 +02:00
Thomas Hartmann
f69a466534 QmlDesigner: Adapt test to api changes
Change-Id: I1340d5a9654f4f757790206fe010004adb6ea236
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-28 11:35:16 +00:00
hjk
eefe4fb7f7 Debugger: Add a dumper test for shared_ptr<ThingWithVTable>
... and fix lldbbridge to pass it.

Change-Id: I2c20cfafe5d7695d4359521cbfcbdc235dacbc82
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-25 11:57:24 +00:00
Kevin Funk
062bf190b8 tst_dumpers: Restore compilation with MSVC
We need to explicitly pass -MD when compiling source files. Unsetting
QMAKE_CXXFLAGS_RELEASE under MSVC strips this flag.

Error:
watchdata.obj : error LNK2038: mismatch detected for 'RuntimeLibrary':
value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in
debuggerprotocol.obj
watchutils.obj : error LNK2038: mismatch detected for 'RuntimeLibrary':
value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in
debuggerprotocol.obj
tst_dumpers.obj : error LNK2038: mismatch detected for 'RuntimeLibrary':
value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in
debuggerprotocol.obj

Follow-up on 0bf4bfcade

Change-Id: I4b63f23c6a0bb6330d30b5ffe894fa0ddcd74cab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2016-11-25 09:26:53 +00:00
hjk
5a914b55fc Debugger: Use int instead of bool in test code that can be C
Change-Id: I91fa6e97d4fbffef14a64c2203710923a13d7479
Reviewed-by: hjk <hjk@qt.io>
2016-11-24 17:11:16 +00:00
Marco Bubke
9dfa210011 Clang: Partial fix for highlighting off output arguments
We get the source range for the parameter list and not the arguments
in the initializer list back. So we have to disable the test case.

Task-number: QTCREATORBUG-17101
Change-Id: I65ec6d111766b5728a951b024576cbf777c89728
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-24 16:54:01 +00:00
hjk
99097d011e Debugger: Skip dumper tests automatically depending on build environment
Change-Id: I2df98c283de180f72f2f214637223a7c2f63114c
Reviewed-by: hjk <hjk@qt.io>
2016-11-24 16:25:08 +00:00
hjk
9d7a1fcb0f Debugger: Add a QStandardItem dumper
Change-Id: I503b17e1f36158a774dcf096b19ba628f0cc0205
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-24 09:51:40 +00:00
Robert Loehning
800a932e19 QmlDesigner: Fix ambiguous ids in plugin testproject
Change-Id: I05b077f52d643703d0714df99968eb05dfd07dc2
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2016-11-24 09:48:22 +00:00
Marco Bubke
03bbd88eb1 Clang: Fix highlighting of instance with member for writable arguments
struct X
{
  int member;
};


void f(int &argument);

void foo()
{
  X x;

  f(x.member);
}

Task-number: QTCREATORBUG-17101
Change-Id: I6746122dbe86d032b3797a01b5f2257846007f94
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-23 15:22:50 +00:00
Marco Bubke
b196368785 Clang: Add disabled test case for HighlightingMarks
Constructors are not recognized by libClang as callable expressions.

Task-number: QTCREATORBUG-17101
Change-Id: I40eb46c07475e3b2e48bc8117de073732005f8b9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-23 14:47:33 +00:00
Tim Jenssen
6fe90532dc Utils: Add offset to search results
Offset are better to compute the length of a text range. The only problem
is that we get them for utf8 because that is the text representation of
source file. QTextDocument is Utf16 based, so it can not binary represent
the source file. Actually I do not see a simple performing workaround for
it.

Change-Id: Id615e1ee6a6e85c6ecc4f8044e275142409d9b46
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:33:34 +00:00
Tim Jenssen
7f757884c5 Clang: Extend clang query
It's a first step to introduce clang query.

Change-Id: I4d001a8883f56066765ce6bc561fa3f49611c0a4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:16:04 +00:00
Nikolai Kosjar
c4d9f6ac3f Clang: Fix updating dependencies
...if the registered document comes with unsaved content.

This can easily happen if the document is opened and modified by a
refactoring action.

Task-number: QTCREATORBUG-17295
Change-Id: I3a95fb495b6122248ceaa80985e838851ba2c0e5
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-23 11:50:44 +00:00
hjk
e9f0f37070 Debugger: Robustify QRegExp dumper
The capturesTexts cache may or may not be warm, and
we may or may not be able to warm it. Make the dumper
work in as much cases as possible.

Change-Id: I9d9e0ec0c6a1bcf7288352c2834fedd42071d068
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-23 11:23:04 +00:00
Robert Loehning
4e947e713b QmlDesigner: Add warning about expected error to testfile
Change-Id: Idb6d26f01e1a4be70fa30ec8175b6b4e509bbaf7
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2016-11-23 07:31:30 +00:00
Robert Loehning
7fb9108489 QmlDesigner: Fix ambiguous ids
Change-Id: I28b0dc2ff0fa919ca99c468c9648ab105c7e38c5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2016-11-23 07:31:20 +00:00
hjk
584a8c2afe Debugger: Remove some old and unused test code
The functionality tested is used in other tested places.

Change-Id: I62883e81dab9f26ac63e1f45f039571ca1f6a32e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-21 13:44:20 +00:00
Orgad Shaneh
6d1d1a4416 Merge remote-tracking branch 'origin/4.2'
Change-Id: I957c22020fbacb2f631220b0cdc7fa16a782798b
2016-11-21 10:25:45 +02:00
hjk
ba87a5dace Debugger: Make QFiniteStack dumper work on macOS
qfinitestack_p.h is not self-contained, #include <stdlib.h>
manually to get access to malloc().

Change-Id: I628e5e2a872d361bb7b246ec7333efb3c94dae98
Reviewed-by: hjk <hjk@qt.io>
2016-11-18 16:30:30 +00:00
hjk
96b907a1e8 Debugger: Fix QFiniteStack dumper and add missing auto test
Change-Id: If5f242f8d5184a0f2c62f6211f2ba89cda0cac07
Reviewed-by: hjk <hjk@qt.io>
2016-11-18 13:32:05 +00:00
Nikolai Kosjar
da54b1e6a9 Clang: Tests: Fix compilation
refactoringclient-test.cpp:126:76: error: no matching function for call to
'ClangRefactoring::RefactoringCompilerOptionsBuilder::build(CppTools::ProjectPart*,
CppTools::ProjectFile::Kind&)'

Broke with:

    commit 36d4d01cd3
    Clang: Take precompiled headers into account when parsing source files

Change-Id: I7c5a2edec0859584ea2b33e144178060788cd4d9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-11-17 15:35:22 +00:00
Marco Bubke
19a00f418f Utils: Add const reverse iterators to SmallString
Change-Id: Iefd9d6abafbe38dcb7d3ed9ea200ac3244902433
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-17 15:06:46 +00:00
Marco Bubke
8a16151601 UnitTests: Add QByteArray printer
Change-Id: I1461db8b5337e6e6aa387edc4da72ca3379d8b73
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-17 15:06:31 +00:00