Commit Graph

2231 Commits

Author SHA1 Message Date
Ivan Donchevskii
4ba4079db2 CppTools: Use -isystem only for non-project includes
...and return -I for ones in project.

In case -isystem is set for all includes we don't get
proper reparse when the included file is in angle brackets
and is changed.

Change-Id: Iba912edfc488aed2a4484f6a742a7c36099e8a13
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-01-26 14:00:57 +00:00
Friedemann Kleint
f482270432 Introduce Q_FALLTHROUGH()
Silence g++ 7.X warnings.

Change-Id: I9d06d04b496c9ec060e13e1be6f43d8fbadb1f3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-24 14:50:43 +00:00
Nikolai Kosjar
3ea921c216 CppTools: Move some decls from header to source
...as there is no client using them.

Change-Id: I2fbbe247e6f4bad537644a9574ddcc0606bfa13e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-22 14:25:33 +00:00
Nikolai Kosjar
9f4c55528d CppTools: Remove unused signals/functions
Change-Id: I00420f98eb49acfbcbb7f719b0d3a867a8882d31
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-19 14:54:13 +00:00
Nikolai Kosjar
43a3ea1d22 CppTools: Remove pointless loop
Change-Id: Ie6c597421f81529973351a6363c0110435e42c29
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-19 14:54:08 +00:00
Nikolai Kosjar
0a4073ef90 TextEditor: Return hover handler priority by callback
...to get rid of the asynchronous code path.

Change-Id: I56377510440631b0be712333b2a4018717c86389
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-19 13:57:57 +00:00
Nikolai Kosjar
76c25bcd6a Clang: Provide tooltips
This includes also the query data for the help system (F1) for an
identifier under cursor.

Regressions (libclang changes necessary):
 - Function signatures do not contain default values.
 - Aliases are not resolved for/at:
   - template types
   - qualified name of a type

Fixes/Improvements:
 - Resolve "auto"
 - On a template type, show also the template parameter.
 - For a typedef like
     typedef long long superlong;
   the tooltip was "long long superlong", which was confusing.
   Now, "long long" is shown.

New:
 - Show first or \brief paragraph of a documentation comment.
 - Show size of a class at definition.
 - Show size of a field member in class definition.

Task-number: QTCREATORBUG-11259
Change-Id: Ie1a07930d0e882015d07dc43e35bb81a685cdeb8
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-01-16 15:32:15 +00:00
Nikolai Kosjar
d7409e01a7 CppTools: Fix showing main help sentence in tooltip
Mouse hover on e.g. "QString" is supposed to show

   QString
   The QString class provides...

The sentence was removed unintentionally by

  commit a7e8406ced
  TextEditor: Remove unneeded functions in BaseHoverHandler

Change-Id: I356e66c0c21c528822c0f2e37f8058fa7b7d89bf
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-01-16 08:31:19 +00:00
Nikolai Kosjar
5e861d2be6 CppTools: Move CppHoverHandler to CppTools
This is in preparation for clang code model to provide its own hover
handler.

Change-Id: Ifbdd96f427989bd5d1fbc4badb9c38108485c2f2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-16 08:31:11 +00:00
Nikolai Kosjar
53a744a6df CppTools: Improve a function name
Change-Id: I30f9048aff18440d8cc6a6247f5fd5bcdba5058d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-16 08:20:22 +00:00
Orgad Shaneh
6285a6e50f CppTools: Fix build
Broke by e51683412b.

Change-Id: I68d1457931f2237a63da4ac2e34f1650b9ff6ea6
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-11 06:46:15 +00:00
Ivan Donchevskii
e51683412b ProjectPart: save codegen flags in project part
And add them to other clang code model arguments.
These flags provide architecture for cross-compilation
when ios kit is selected.

Task-number: QTCREATORBUG-19437
Task-number: QTCREATORBUG-19430
Change-Id: I7a485f49d637371bb28b2096086d7d8a4b0c404a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-10 10:59:56 +00:00
Eike Ziller
cff2cc90e2 Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/cpptools/clangcompileroptionsbuilder.cpp
	src/plugins/cpptools/clangcompileroptionsbuilder.h
	src/plugins/cpptools/compileroptionsbuilder.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.h
	src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
	src/plugins/qmlprofiler/qmlprofilertraceclient.h
	src/shared/qbs

Change-Id: I364ababc5d41046d17e999096c4a7187c4e4e010
2018-01-09 13:13:00 +01:00
Robert Loehning
e07bf2f682 Make missing uses of IDE name configurable
Change-Id: Ie89293b80adfacea19bcb949e4524f16fbb223f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-01-03 10:26:24 +00:00
Andre Hartmann
6a9c45ab71 CppIncludesFilter: Change default shortcut from 'a' to "ai"
Reason: 'a' is also used for "Files in Any Project",
so there was no way of using both filters exclusively.

Task-number: QTCREATORBUG-19531
Change-Id: Icba0e993b004eb72b8cc419f52b171c5289bc0a1
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-03 08:30:43 +00:00
Ivan Donchevskii
b861e31f1a Clang: macOS: fix unknown integer types
Always exclude clang include paths which do not come
with libclang used by code model.
This solves the issue with GCC that uses system clang
include folder on macOS.

Task-number: QTCREATORBUG-19397
Change-Id: I3b4845248a3cf03a95fbd4038856f8fb31346bfa
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-01-03 07:56:53 +00:00
Andre Hartmann
b2aa1b9845 Locator: Cleanup and modernize Locator and filters
* Omit QLatin1{Char|String}
* Use member initialization
* Use range-based-for
  (and fixed the cases with non-const Qt container)
* Sort includes to common style

Change-Id: Ibc33a732bb153862efd6d5febfac758229cb61d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-12-30 18:58:25 +00:00
hjk
cc88302309 De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per
"interesting" type.

Current situation:
  - The global object pool does not scale well for looking up
    objects, as iteration plus qobject_cast typically iterates
    over all pooled objects.
  - User code that can use typed results from the object
    pool need to have access to the full type definition anyway,
    i.e.  depend on the plugin of the target class anyway.

The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.

This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.

Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".

Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-15 07:08:05 +00:00
Ivan Donchevskii
7a7123b1bc Clang: add globalFollowSymbol to RefactoringEngine
Allows to follow outside of current TU.

Change-Id: Ieea2fd72bfdf6d60a988b40efcf2f41c5a71d045
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-14 14:25:14 +00:00
Ivan Donchevskii
c760804102 Clang: always use -isystem for compiler options builder
We always provide the full includes list ourselves so
it will not change the includes order.

Change-Id: I84ee2ca7f05bfb71ae400f0e9e0b8f52810252b3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-14 14:24:35 +00:00
Tobias Hunger
7c35a38100 Session: Move all functionality related to Nodes into ProjectTree
Do no longer expose Nodes from the SessionManager's API. These are now
exclusively handled by the ProjectTree.

Change-Id: I585c2ac919462073870363436e767640775d9045
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-12 13:44:09 +00:00
Tobias Hunger
18f38ff18e Project: Make Project::files return a FileNameList
Change-Id: I75ceb22ac65b8288d824f229d44089cba6fc8ea3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:09:59 +00:00
Ivan Donchevskii
8afa7a64cc Clang: Plugins: Put settings into the TabWidget
Make tidy/clazy switch more intuitive.

Change-Id: I13d17376bdace039ae371693e28f6fcb0b493244
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-12-07 13:36:51 +00:00
Ivan Donchevskii
6953996aa8 Clang: Plugins: Make default settings empty
Plugins make code model slower. So do not enable them
until you need them.

Change-Id: Idaba0509417d70b41b88b5d66d731a1dae0e9c2f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-12-06 07:33:27 +00:00
Ivan Donchevskii
8efb598e60 TextEditor: move Link class to separate header in Utils
Link is a common class and is used across the plugins.

Change-Id: Id92e47e1b8604316ca8b970804e57abaf404ec28
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-27 13:57:02 +00:00
Eike Ziller
4c8db5e9b7 Merge remote-tracking branch 'origin/4.5'
Change-Id: I32715e2fdbb14e4fccc4c58d3fd6052d7c1127f3
2017-11-24 10:03:38 +01:00
Orgad Shaneh
b43e22b8f4 CppTools: Disable Qt keywords for C files
Task-number: QTCREATORBUG-1478
Change-Id: I29afc0f38e5f86ca2c30d5b6551974df68ee7512
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-24 08:43:27 +00:00
Orgad Shaneh
ec86bf8ca6 CppTools: Fix initial macro parsing for generic project
The extra macros in the config files are being read in
CppModelManager::internalDefinedMacros(), but they also affect the language
features in ProjectPart::updateLanguageFeatures().

Task-number: QTCREATORBUG-1478
Change-Id: Ic197b0b7d4cc6e6a74637da0c710b0630daae25c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-24 08:40:56 +00:00
Nikolai Kosjar
807ef044bf Clang: Remove unused function
Change-Id: Ia76e8cf523b301865d902a3768439a648c23da01
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-22 14:02:40 +00:00
Christian Stenger
2ab27c0842 CppTools: Fix compile with Qt5.6 and gcc4.9
Change-Id: I47668b784106c78444869595143ec8aff6928e8f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-22 13:55:59 +00:00
Ivan Donchevskii
63ea3ac004 Clang: Improve code model plugins settings UI
Describe clazy levels, improve layouts.

Change-Id: I4895682ea7d10ea910c2d53725073c9c870bb306
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-22 13:33:54 +00:00
Ivan Donchevskii
08e3d8f011 Clang: Android: fix clang code model errors
Add missing gcc include directories in Android toolchain.
This introduces the similar "magic" that we have in qmake
(*qtsource*/qtbase/mkspecs/common/android-base-head.conf)
but allows us to have those paths wherever we use android
toolchain.

Change-Id: I5740f1f2339fd30670567f24db2be2454f665f41
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-22 10:56:10 +00:00
Ivan Donchevskii
1601f53542 Clang: StaticAnalyzer: use the default compiler options builder
Analyzer has clang path and can generate necessary header paths
to be able to use default options builder.

Change-Id: I9bb1fc158f045f6e099817c5557ee7d9e38416fb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-22 10:55:44 +00:00
Eike Ziller
89f9f22035 Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/clangcodemodel/clangutils.cpp
	src/plugins/cpptools/clangcompileroptionsbuilder.cpp
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I0728f08171103259407bbbb35f93b70c2f2e18d0
2017-11-21 13:28:55 +01:00
Ivan Donchevskii
194bde265c Clang: Define __FUNCSIG__ and others for msvc toolchain
Affects __FUNCSIG__, __FUNCTION__ and __FUNCDNAME__.
By default Clang can't concatenate strings under those
macros with other strings.
Because of that we need to define them with empty strings
to make clang compile such cases without errors.

Task-number: QTCREATORBUG-19295
Change-Id: I9a3770ebe56b4b8a49ba9982c5a1ba90c8f0b304
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-21 11:31:22 +00:00
Nikolai Kosjar
2abf1f29cc Clang: Add identifying macro Q_CREATOR_RUN
Use the same we use for the built-in code model.

This is useful for conditions of pragmas.

Task-number: QTCREATORBUG-16847
Change-Id: I4c83be46bb2b8a23e4c8f70d98e2b4c9572121ee
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-21 10:05:31 +00:00
Nikolai Kosjar
cd74eff1ba Clang: Fix coverty scan diagnostics in constructor
CID 1462055:  Uninitialized members  (UNINIT_CTOR) Non-static class
member "m_tidyChecksWidget" is not initialized in this constructor nor
  in any functions that it calls.

Change-Id: Ie6ba9f2714238feb03a9fc4006c0475b658cdf07
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-21 10:05:24 +00:00
Ivan Donchevskii
32bae7ef6c Clang: use local renaming based on ClangCodeModel
Provide refactoring engine for ClangCodeModel and
implement missing methods.

Change-Id: If5c913e0c5a7941cd2ced54d0fcfa4d625eadc93
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-20 10:24:47 +00:00
Ivan Donchevskii
8eececaa96 Clang: add clang plugins checks to code model settings
Add UI controls to change settings and apply them
together with warnings and command line options.
Current settings are not very flexible but should be
easy to test and use without reading tidy/clazy help.

Change-Id: I1ca6b49a42a1169b34a703dd50de0bbc105df28f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-16 11:05:21 +00:00
Eike Ziller
2d30d3ddd6 Merge remote-tracking branch 'origin/4.5'
Change-Id: Ib6739725e6b251ea962880e4b72700c5be5a192c
2017-11-14 11:24:03 +01:00
Orgad Shaneh
d2b8076fec CppTools: Fix highlighting when matching with scope
class Foo {
  void funcInside() {}
  void funcOutside();
};

void Foo::funcOutside() {}

Search for Foo::func in the locator. func was not highlighted.

Change-Id: I923bd3ef2df47c5fa030b8899d1b4df7437b1820
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-14 07:04:07 +00:00
Orgad Shaneh
a6cda6dbe0 Merge remote-tracking branch 'origin/4.5'
Change-Id: I16e3bb9ee3a1e6dc6edf7a65f8a137a25cda4fe3
2017-11-05 16:49:17 +02:00
Orgad Shaneh
bacfc28a36 CppTools: Match also function arguments in locator
Useful when there are several overloads for the same function.

Change-Id: I325bda7d2fdf4108f71a61d5473cd55310c51c28
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-02 09:26:17 +00:00
Tobias Hunger
3529e785c4 CppTools: Make create* methods return something
Change-Id: I20cfdaef23e9b7c48c9d3b4f27157e771fd9bc7f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-01 14:19:29 +00:00
Nikolai Kosjar
5ba40cb7fb Clang: Require LLVM/Clang >= 5.0.0
...for the code model parts and declare 5.0 as the supported version for
the clang static analyzer.

Adapt versions and tests, remove code assuming clang <= 5.0.

LLVM/Clang 5 was released on 07 Sep 2017.

Task-number: QTCREATORBUG-18931
Task-number: QTCREATORBUG-18657
Task-number: QTCREATORBUG-17187
Task-number: QTCREATORBUG-14881
Change-Id: I53b00258ca06a1d2e57f9379dacc54b310687295
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-27 14:21:19 +00:00
Ivan Donchevskii
81f5c1c8ec Clang: implement globalRename based on clang Index
Has the same limitations as findUsages.

Change-Id: I8de4df2ecbfd8a4f3073666994398dc43af0d73c
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-10-25 13:35:48 +00:00
Ivan Donchevskii
050b4dd2f5 Clang: implement findUsages with existing index
Functionality is limited to the abilities of
current index which is not updated and is
generated only at project open.
Search box temporarily doesn't allow to "Search again".

Change-Id: Id1047f27ad0aafc901f06aa51ad38ceab95eaebb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-24 10:46:52 +00:00
Ivan Donchevskii
1184792fe7 CppTools: remove ambiguity in Usages class name
Usages class is used in findUsages and globalRename in further changes.

Change-Id: I2f314e4ebe7828e59fcc3cae824893c96eb21cab
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-24 10:18:27 +00:00
Marco Bubke
b9d268977e Clang: Add usage functions to symbol query
Change-Id: If68a5119c863e616fea40275136d028abcf441f3
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-23 18:13:44 +00:00
Ivan Donchevskii
b10f8484c7 CppTools: merge CompilerOptionsBuilder with Clang one
Since it's never used for other compilers.

Change-Id: I9512692d1dc9f9a701ea2453b7d50005478bed5d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-23 12:46:34 +00:00