Commit Graph

2563 Commits

Author SHA1 Message Date
Nikolai Kosjar
77a77b954e Clang: Do not use run configuration for determining toolchain type
Change-Id: I9d09dd800043b88925fad4873759f6c4f8638981
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-04-21 10:15:16 +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
Eike Ziller
a6aafe3c45 Add QTC_GUARD
Similar to QTC_CHECK, but has the boolean result of the condition as
value. Use it in the form

if (QTC_GUARD(condition)) { ... }

Replace some occurrences of

QTC_CHECK(condition)
if (condition) { .... }

Change-Id: I8eea02f869eb7a183dfbf4810dace48097880519
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-04-18 11:34:03 +00:00
Nikolai Kosjar
9cc50a96e4 Clang: Fix updating warning config widgets on remove
Problematic use case was:
 1. Go to projects mode, select "Clang Code Model"
 2. Click "Copy...", click "OK" and add e.g. " -Wbla"
 3. Click "Remove"
 ==> The configuration is reset (combobox), but the warning options are
     not (" -Wbla" is still there).

Change-Id: Ifc445a3fa0e3b3191915cf7bca220f4bef848069
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2016-04-15 12:02:28 +00:00
Eike Ziller
8a77eacf8d Merge remote-tracking branch 'origin/4.0'
Change-Id: Ied609608f6b12aa923c67777bc5a273c4d8fbcbb
2016-04-15 10:07:55 +02:00
Nikolai Kosjar
e2e3be09e3 Clang: Enable exceptions explicitly
For some reason, clang 3.8.0 on Windows does not enable exceptions anymore,
which leads to parse errors in MSVC headers (reported upstream [1]).

With this change, we can finally parse main/mainwindow.cpp of a Qt Widgets
Application for a MSVC2015 Kit and libclang 3.8.0 without any error.

[1] https://llvm.org/bugs/show_bug.cgi?id=27324

Change-Id: I532ad4852a06318baf083d363378bc577b3c4309
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-13 07:13:25 +00:00
Nikolai Kosjar
4e0b55f673 Clang: Undefine language features as fix for MSVC2015/clang-3.8.0
This applies the following change for the clang code model, too.

  commit d13d179524
  Clang Static Analyzer: Workaround analyzing MSVC2015 projects with clang 3.8.0 II

Change-Id: Ia229d7e8b24c2e1c0a83d9a53c623ea1f79c4a06
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-12 14:54:06 +00:00
Nikolai Kosjar
5ff5211a25 Clang: Set -fms-compatibility-version explicitly
Infer the version from the _MSC_FULL_VER macro, so it cannot get out of sync
with that.

Adapt the analyzer to do the same.

Based on

  commit daf08d8702
  Clang Static Analyzer: Workaround analyzing MSVC2015 projects with clang 3.8.0

Change-Id: I9d34abdbe2c83fe271eadd8d051caad43aca6772
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-12 12:59:03 +00:00
Nikolai Kosjar
0dc1cec7bf CppTools: Include "group id" in CompilerCallData
We will need the id in a follow-up change to match the corresponding project
part.

Change-Id: Id7686503f96fb238c9fa9857e7fde5cf94b0bcc7
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-12 12:37:45 +00:00
Eike Ziller
5c87432260 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp

Change-Id: I6ae2d37290643d69390f679a54f7596782f3d97f
2016-04-12 11:34:46 +02:00
Nikolai Kosjar
276f4c489c Clang: Explicitly set the target triple
As for the analyzer, this makes us independent of the default triple and will
most likely reduce the maintenance - e.g. the target implies certain internal
command line arguments, we will profit from added ones.

This fixes parsing of mingw headers with the clang code model.

Change-Id: I722b981125a80fac5f62a7af40a83ecdd7bbf811
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-11 10:16:34 +00:00
Alessandro Portale
984a6eca73 cplusplus: Make functions of Icons static
This avoids multiple instatiations and reloading of the same image files.

Change-Id: I4d0bb955e23c1cb817671c25bff4e74fb7b3d0f4
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-04-06 08:48:32 +00:00
Oswald Buddenhagen
e426d08e54 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/debugger/debuggerruncontrol.cpp

Change-Id: I81b43480a1369e3d7be60ae26e812dda6b962b0b
2016-04-01 17:31:39 +02:00
Nikolai Kosjar
eeb566ef74 CppTools: Update known doxygen commands
...from https://www.stack.nl/~dimitri/doxygen/manual/commands.html

/*!
 * New doxygen that are highlighted and completed:
 * \authors
 * \callergraph
 * \category
 * \cite
 * \copybrief
 * \copydetails
 * \copyright
 * \details
 * \diafile
 * \dir
 * \docbookonly
 * \enddocbookonly
 * \endinternal
 * \endmsc
 * \endparblock
 * \endrtfonly
 * \endsecreflist
 * \enduml
 * \extends
 * \hidecallergraph
 * \hidecallgraph
 * \idlexcept
 * \implements
 * \includelineno
 * \latexinclude
 * \memberof
 * \msc
 * \mscfile
 * \parblock
 * \private
 * \privatesection
 * \protected
 * \protectedsection
 * \protocol
 * \public
 * \publicsection
 * \pure
 * \refitem
 * \related
 * \relatedalso
 * \remark
 * \result
 * \rtfonly
 * \secreflist
 * \startuml
 * \subpage
 * \tparam
 * \vhdlflow
 */

Task-number: QTCREATORBUG-10145
Change-Id: I7cc3ff0d6d58bbd188ca8056302fda790dcbf0ce
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-03-31 11:46:01 +00:00
Nikolai Kosjar
ed168b2e05 CppTools: Update known qdoc commands
...from http://doc-snapshots.qt.io/qt5-5.7/27-qdoc-commands-alphabetical.html

/*!
 * New qdoc that are highlighted and completed:
 * \annotatedlist
 * \default
 * \div
 * \inherits
 * \inqmlmodule
 * \instantiates
 * \noautolist
 * \qmlabstract
 * \qmlattachedproperty
 * \qmlattachedsignal
 * \qmlbasictype
 * \qmlclass
 * \qmlmethod
 * \qmlmodule
 * \qmlproperty
 * \qmlsignal
 * \qmltype
 * \span
 * \uicontrol
 */

Change-Id: I55b8e83814a6008b6580a6e50ca780b257d4197b
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-03-31 11:45:53 +00:00
Nikolai Kosjar
24640a6e4e CppTools: Sort doxygen commands
We will update them, so having them sorted is better for finding
duplicates.

Change-Id: I1159ed1f1fce1275d630935a297e85787947ba61
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-03-31 11:45:46 +00:00
Nikolai Kosjar
6ed1a2b3c8 CppTools: Rewrite cppdoxygen.cpp with cplusplus-keywordgen
Braces all over the place since the tool does not respect the coding
style and cppdoxygen.cpp was changed with regard to the braces coding
style in the meantime:

  commit 29a93998df
  Remove braces for single lines of conditions

Next step is to use the tool for updating the qdoc/doxygen keywords.

Change-Id: Ib95b5991ebd794d144848ae052fa7f28a6d10850
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-03-31 11:45:39 +00:00
Nikolai Kosjar
334e3edd18 C++: Extract base startOfOperator()
...in order to remove some duplication.

Change-Id: Ie974b6ed9418967ad80b4604088b0e1c293b59d0
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-03-31 09:30:37 +00:00
Nikolai Kosjar
4b3a987c39 C++: Equalize startOfOperator()
There are two versions of startOfOperator:
    * InternalCppCompletionAssistProcessor::startOfOperator
    * ClangCompletionAssistProcessor::startOfOperator

The latter started as a copy of the former, but the former got some bug
fixes in the meantime.  Adjust both versions to each other, so it's easy
to diff them and to extract the duplication in a follow-up change.

Change-Id: Icf48386bf1ad0fa473bec476c5412be9b1890139
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-03-31 08:01:58 +00:00
Nikolai Kosjar
da5309cbc6 C++: Fix completion for doxygen tags II
For assist processors that run in a worker thread, the QTextDocument is
recreated with AssistInterface::prepareForAsyncUse and
AssistInterface::recreateTextDocument.

Since some assist processors (C++, QmlJS) rely on the user states of the
QTextBlocks, these must be recreated, too.

In the referenced bug report the lexer state (user state) of the
previous QTextBlock was invalid and thus the "Doxygen tag completion"
failed.

Task-number: QTCREATORBUG-9373
Change-Id: If668e98aa6f9fe9fc107c7476fc831e92a0d7572
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-03-31 07:12:49 +00:00
Nikolai Kosjar
4de62a7349 C++: Fix completion for doxygen tags I
There are three cases that must be handled:

 1. Completion in C++ style comment
 2. Completion in first line of a C style comment
 3. Completion in non-first line of a C style comment

This change fixes case 1 + 2. Case 3 will be addressed in a follow-up
change, same goes for the duplication.

Task-number: QTCREATORBUG-15143
Change-Id: I449711f965ddcbbe6158870a8a5ae33218e0d238
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-03-31 06:51:34 +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
Nikita Baryshnikov
5f91cb0d68 CppTools: fix metatype registration macro usage
in places where we do not need it

Change-Id: Ibf35f8144da859fffa3e0a7b6bb262284ec2292a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-24 08:15:44 +00:00
Eike Ziller
f1e14468c6 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/coreplugin/find/findtoolbar.h

Change-Id: I7db695a28473d1b16c46b1e39a4d6fce537c13a1
2016-03-16 15:28:47 +01:00
Tobias Hunger
12889af047 Move C++ mime types from cppeditor to cpptools
Have the mimetypes and their registration in the same plugin
as their constants.

Change-Id: I350ab4eb0da3941ca9282ff98d8d0e158b568ef3
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-03-15 16:00:18 +00:00
Tobias Hunger
09cdd1c4a5 CppEditor: Register qdoc as a separate mimetype from c++ sources
Add a new constant for qdoc mimetype to cpptoolsconstants.
Make the CppEditor handle qdoc mimetype.

This change has one user user visible effect:
Adding qdoc files to a qmake project will no longer put those files
into SOURCES where qmake will then try to compile them. They will show
up in "Other Files" instead.

Task-number: QTCREATORBUG-15872
Change-Id: Ibbf9af0a84fab59138f6b9ab41f1bba737b455c2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-03-15 14:35:08 +00:00
Orgad Shaneh
ba517fcfab ExtraCompiler: Remove stored targets list
Itereate over the hash keys instead.

Change-Id: Ib14bef708b74ed1938bcb985b3a5091aca704391
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-15 11:52:49 +00:00
Eike Ziller
450d4c4c84 Merge remote-tracking branch 'origin/4.0'
Change-Id: I7cca91daebb92c245ef49a198e1e6303311194fa
2016-03-11 11:25:27 +01:00
Tobias Hunger
972ea4cba0 ExtraCompiler: Run extra compiler in a thread
and make sure there are not too many of these threads
running at any time. This stops the massive process
startup when loading a project with many UI files, etc.

Task-number: QTCREATORBUG-15795
Change-Id: Icfcddd80d04e36b61ecafbbefe5a1a8b7ea02ec6
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-03-11 09:49:25 +00:00
Orgad Shaneh
4191d9ddcd CppTools: De-noise SemanticHighlighter
Change-Id: Id4655b0d81104468f6fe799744e49e505d3b8748
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-09 15:36:48 +00:00
Nikolai Kosjar
2b2ba298f3 CppEditor: Generate doxygen comments for functions with macros
...at least for object-like macros. This handles the common case where a
macro before the function signature annotates the DLL import/export.

Task-number: QTCREATORBUG-15819
Change-Id: I79f22508188019402fb7345222408aaf90106f20
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-03-04 14:22:27 +00:00
Nikolai Kosjar
5fcdeb7727 CppTools: Apply has_include workaround also for a mingw toolchain
Change-Id: Ib501b40870f71a552b0bd38fa4977b450fd37954
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-03-04 09:53:59 +00:00
Nikolai Kosjar
83e18c127c Clang: Introduce warning configuration per project
Change-Id: I5b9a330274e6f72b0786259eb25aa454877d4eef
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-03-01 15:55:30 +00:00
Nikolai Kosjar
8cfef9657a Clang: Introduce switching/adding of warning configurations
A warning configuration is a list of command line (warning) options for
libclang. Three non-editable built-in configurations are provided by
default. The user can copy a configuration to customize it.

This is still a global setting and it changes take effect after
re-opening a document. Both issues will be addressed in follow-up
changes.

Change-Id: I86667d7dc39ad31b88666454220e6da563797740
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2016-03-01 11:21:36 +00:00
Alexandru Croitor
bed88818ce C++: Implement context-aware expand / shrink selection actions.
Implement selection expanding / shrinking, that is aware of C++
semantics, thus giving smart selection changing.

Change-Id: I1386a20597fa6bb85c3aa0d8ddfb87cdb3fd7c38
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-29 08:15:03 +00:00
Nikolai Kosjar
4795059703 CppTools: Avoid inserting invalid entries into cache
...of resolved files.

This is an issue when first a misconfigured project (missing include
paths) is indexed. E.g. then <QtTest> resolves to "", which is inserted
into the cache. Resolving the same header for subsequent projects has
returned the empty string although their header paths were correct.

This led to wrong includes of documents from the global snapshot.

Task-number: QTCREATORBUG-15736
Change-Id: Ia3e3a06775a50dd75bc62a46d674c7b46a1c5965
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-02-26 12:00:36 +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
Nikolai Kosjar
32842e754d CppTools: Reduce calls to mime database.
...by removing the unneeded ProjectFileAdder. Its job is already done
earlier, so use the results.

Change-Id: Ifd865e6203ed6162a0d852c2128fb6d30208a52b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-02-24 17:30:34 +00:00
Christian Kandeler
537125155d QbsProjectManager: Reduce calls to mime database.
Qbs already has some definite information about file types.

Change-Id: I024feeae3e6df5ec5462924ffedc7332e585f6b7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-02-24 16:21:16 +00:00
David Schulz
9aa51d4857 Editor: Fix whitespace cleaning.
Task-number: QTCREATORBUG-7994
Change-Id: I6c197ccc3a148555018e8f8184d116c88d7ea400
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-24 12:03:12 +00:00
Eike Ziller
74cdce071f Merge remote-tracking branch 'origin/3.6'
Conflicts:
	src/shared/qbs
	tests/manual/proparser/main.cpp

Change-Id: I13654bf10c14eb6b1d6805fe86b67ac73b2e4d75
2016-02-24 10:08:37 +01:00
Orgad Shaneh
6234511a2c CppTools: Use a shared thread pool
Without this, too many threads are spawned, and loading a project takes
forever.

Change-Id: I3c22557ddd7bfb0c70f7b089c276432e3b003097
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-19 10:21:40 +00:00
Orgad Shaneh
8b0d849a27 ExtraCompiler: Store contents as Utf8
Avoid conversions when they're not needed.

Change-Id: I7e996bc6e87be4327d75f0d743ff2de38d6ccc32
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-02-18 09:33:04 +00:00
Nikolai Kosjar
89199b519b Clang: Indicate available "fix its" with a light bulb
...at the end of the line, just like for the "Apply Function Signature
Changes" refactor action.

* Hovering the light bulb shows the tooltip "Inspect available fixits".
* Clicking the light bulb leads to the refactoring menu, as if the user
  hit Alt+Return.

Change-Id: Iaf7b3734c43e21fc28e6b0658f517d98858c0e0c
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-02-16 18:12:12 +00:00
Ulf Hermann
2e3e060520 Generalize support for extra compilers
Allow for different extra compilers which may get called to generate
additional code for the code model. The build system is expected to
know what files are generated from which source file and the extra
compilers know how to generate the content of those files, without
touching the build directory. the uic adapter is refactored to be
the first such extra compiler.

The extra compiler is run when an editor for its source document
loses focus, or after a timeout of 1s when the source document has
been changed.

Change-Id: I13c110c61120c812f02639a3684144daf8979b37
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-16 12:53:05 +00:00
Eike Ziller
6e5d4b892e CppTools/Editor: Use Utils::runAsync
Change-Id: Ifcc2a34e3478eb84f95221b79e39f7a670e6b2e0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-15 12:14:21 +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
Nikolai Kosjar
e1b14565fa CppTools: Do not clear project state on session unload
Affected functionality was, among others:
 * Getting the correct project part when opening a file
 * Fallback project part (merged defines/includes) not up to date
 * Fallback for "Switch Header/Source" not up to date

In the early days sessions switching was probably implemented by "close
all projects of session X, open all projects of session Y". That's not
the case anymore today.

Change-Id: I4c6a80e2eb219615d3ea6fcf07be7c05072c8832
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-12 07:48:27 +00:00
Christian Kandeler
b41346cf5b CppTools: Add file path to extra info in function Locator filter.
This helps tremendously in the not uncommon case of the same class being
implemented in several files (e.g. for different operating systems).
Until now, users would be completely at a loss as to which of the
results was the one they were interested in.

Change-Id: I3ef8c8dc93b89e68eaf323a7ad2067b075d8cfb1
Task-number: QTCREATORBUG-11125
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-02-04 10:36:47 +00:00
Christian Stenger
26c7afdfb7 TextEditor: Fix compile with gcc 4.7.3
Change-Id: I59b401c4d7a75398fddc8f6e3a0671fc49f0cb47
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-02 14:40:14 +00:00