Commit Graph

1868 Commits

Author SHA1 Message Date
Nikolai Kosjar
4d1a1981a8 CppTools: CompilerOptionsBuilder takes project part by reference
...since it assumes a project part != 0 and does not participate in
ownership.

Change-Id: Ia9c1eca52776990576a2dac61e9144234b04c59c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-11 09:51:19 +00:00
Nikolai Kosjar
9d7b054120 CppTools: Fix potential race condition
...when acessing m_headerPaths, m_projectFiles or m_definedMacros from
different threads.

ensureUpdated() locked the mutex before writing the variables, but
reading them happened with an unlocked mutex.

Change-Id: I4951fd58f1939e4e50534a018dd600004789668e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-09 12:10:14 +00:00
Nikolai Kosjar
56f37f78b2 Clang: Speed up requesting diagnostics
Register the translation unit and request diagnostics from the
clangbackend as soon as the project part is determined. There is no
reason to wait until the parser is finished for the highlighter.

Change-Id: Iebccbf59ebd205389462dcee97363746fb651bb2
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:55:39 +00:00
Nikolai Kosjar
23fa5a7efd Clang: Provide the language option to the backend
Provide the language option (e.g. "-x c++-header") when registering a
translation unit for the editor.

Task-number: QTCREATORBUG-14787
Change-Id: Ie06f9fdab302f1b21ba72cdb65b6aabf9f7bc04c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:54:16 +00:00
Leena Miettinen
a2ae98557d Cpp: Add full stop to end of message
Change-Id: Idbda9e71fcd2322c2925c5dbfdca540992660282
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-10-23 08:05:18 +00:00
Orgad Shaneh
88c5b47e53 CppTools: Minor cleanup in completion tests
* Remove superfluous dot from test file name
* Reuse an existing member

Change-Id: I735dee09ae7ceef4509a4bda87118baaf4d11b01
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-20 08:52:20 +00:00
Tobias Hunger
a447645422 AbstractEditorSupport: Simplify licenseheader handling
Change-Id: I6bad3870b14066716fff5adc2a03b18f1840b6c7
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-10-14 12:05:30 +00:00
Nikolai Kosjar
77270648e8 CppTools: Fix dead lock on project unloading
...with the clang code model.

In updateProjectInfo() we lock the project mutex and emit a signal.
However, the correspondig slot in the clang code model will call back
into a function that needs to lock the mutex, too:

    CppTools::CppModelManager::workingCopy // dead locks here
    CppTools::BaseEditorDocumentParser::InMemoryInfo::InMemoryInfo
    ClangCodeModel::Internal::ClangEditorDocumentProcessor::run
    ClangCodeModel::Internal::ModelManagerSupportClang::unregisterTranslationUnitsWithProjectParts
    ClangCodeModel::Internal::ModelManagerSupportClang::onProjectPartsRemoved
     ...
    CppTools::CppModelManager::projectPartsRemoved
    CppTools::CppModelManager::updateProjectInfo // emits here

Fixed by emitting the signal after releasing the mutex.

Change-Id: Id3f3cd22b0604f343ada56ea13c26f0dc1a75bd6
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-14 10:10:47 +00:00
Marco Bubke
250c8d662b Clang: Add UpdateTranslationUnitsForEditorMessage
If an editor is changing all translation units independent of their project
part they must be updated too. So we introduce a new message to update all
translation units with the same file path.

Change-Id: I70d0ea2bbca9fa880111ff7219573e54f3277026
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-13 14:03:11 +00:00
Nikolai Kosjar
6b6ad446eb CppTools: Make FollowSymbol respect projects
Finding the class definition for a forward declaration or finding the
function definition from its declaration is mostly determined by the
file iteration order. Documents with the most common path prefix are
checked first.

This works fine as long as the files of your project have a common
ancestor. If that's not the case, FollowSymbol might take you to the
definition within another project.

Fix that issue by considering the project part id when constructing the
file iteration order. Since the cached file iteration order now depends
on the projects, ensure to clear it if projects are added, changed or
removed.

Task-number: QTCREATORBUG-15116
Change-Id: I529166bac363959c9fee0b946747fd0370a88809
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-12 15:08:24 +00:00
Nikolai Kosjar
6ced48ea89 CppEditor: Move static symbol finder instance to CppTools
...to it can be reused by other clients more easily. Also, in a
follow-up change it will have a project part dependency that can be
cleared inside the CppModelManager more easily.

Change-Id: Ic9f2ce5212a94fd05ab0571e9ad99d0a25f5bc5c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-12 14:04:31 +00:00
Aleix Pol
b899684a89 Don't put QString in static attributes
It crashed in some places on our code-base due to the so-called "static
initialization order fiasco".
As a solution, it turns the variable into a function. This shouldn't have
a penalty due to QStringLiteral.

Change-Id: I9f8a955afdff878dc2f0db16fec861d81250c243
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-10-09 17:09:45 +00:00
Daniel Teske
307061032c Fix changing "#include" lines after file renaming
Didn't work if there was any folded text before the #include.

Change-Id: I8f16205f06bfaa8b8541401a9ebd5995c15b2227
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2015-10-06 13:17:55 +00:00
Eike Ziller
5c77df1268 Merge remote-tracking branch 'origin/3.5'
Conflicts:
	qtcreator.pri

Change-Id: I87576b71cee9f2f4eb856531f1a8816b1d3738db
2015-09-30 11:01:24 +02:00
Nikolai Kosjar
a7928b4b0b Clang: Integrate clang's fixits as refactoring actions
They are invokable by the usual means (Alt+Enter, editor's context menu
> Refactor) plus by the context menu of the editor's left margin for the
related line.

The fixit text comes directly from libclang and is thus not translated.
We modify the text slighty by stripping the diagnostic category prefix
("note:", "error:", ...) and capitalizing the first letter.

A follow-up change should properly indicate available refactorings with
a refactoring icon in the editor's left margin.

Task-number: QTCREATORBUG-14868
Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-29 11:39:21 +00:00
Marco Bubke
b412eb81ea Clang: Add revision and completion management
Reparsing a document is expensive so we should avoid it by all means. In
this patch we prevent that the same document is send again. It isn't send
too in advance of a code completion if there was no changes before the
the completion position.

Change-Id: I0bb786ba1d4e7ce08611a518cb32f8cf8f4d0037
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-28 15:46:15 +00:00
Nikolai Kosjar
e241444ba3 C++: Comment out a flaky test
The test relied on logic that was reverted with change
915f68deac.

LookupScopePrivate::findSpecialization() gets a "TemplateNameIdTable
&specializations" with a non-deterministic order. Without the extra
logic, the very first entry will be chosen as the found specialization.

The non-deterministic order comes from the TemplateNameId::Compare,
which calls std::lexicographical_compare() with the template arguments,
which are FullySpecifiedTypes. The result of
FullySpecifiedType::operator<() might depend on a pointer comparison.

Change-Id: I8d69d1bb5831145b1c21a5ea848c0043f17ec415
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-09-28 15:30:16 +00:00
Eike Ziller
0ba4781bfc Merge remote-tracking branch 'origin/3.5'
Change-Id: I889b93611d1762121548fb71d1d3493e4adba313
2015-09-25 10:35:42 +02:00
Nikolai Kosjar
c14e73cdd6 CppTools: Fix comparing size for QTC_CPP_FILE_SIZE_LIMIT_MB
Change-Id: I7729fe944e38726d5c4692f6013e60b3f4fd8c26
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-09-24 09:03:02 +00:00
Orgad Shaneh
e5255a1f5c CppTools: Add a test for ObjC not replacing dot with arrow
Task-number: QTCREATORBUG-14583
Change-Id: Icffa9039215a841e200f20b83cda37d782b94e9a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-23 17:30:52 +00:00
Orgad Shaneh
5b12c8d63a CppTools: Support ObjC in member access operator tests
Actual test is added in a follow-up commit.

Change-Id: I645d1e50d4ac9d281e31a0375f64fea849bf5e25
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-23 17:30:36 +00:00
Cristian Adam
08b62bcfd9 CppTools: SwitchHeaderSource file name case sensitivity
Make sure that on Windows the corresponding header /source
file is searched using case insensitive comparisons.

Change-Id: I66b06cd8a7c46b78e8ff24e11803287630f3914b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-23 11:39:11 +00:00
Tobias Hunger
b38a954521 Old-style wizards: Handle line continuation in license templates
This is necessary to have the same template work in the old-style
wizards and the JSON wizard, which supports inserting \n, \t as well
as line continuation for everything.

Change-Id: I11c310998b92650003206484de8f1ecfc6000034
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-09-22 09:17:02 +00:00
Tobias Hunger
af7f098366 LicenseTemplate: Use macro expansion
Convert existing licensetemplate syntax to macro expansion. That
is way more powerful than what we used to have.

Do return the (converted) license template and do not try to fill
in information since that is not available when querying the
template.

Change-Id: Ia4f45ccf055772b21b0c2ce3c083cf49c45ae7d8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-09-22 09:16:48 +00:00
Tobias Hunger
39490240a8 LicenseTemplate: End the license template with at least one newline
Change-Id: I9bffcdbfba3c873324e12a8104da5d277259ea31
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-09-16 14:48:00 +00:00
Orgad Shaneh
81a4f6b970 CppTools: Do not read language features from document in completer
The correct value is set on construction. The document knows *less*.

Task-number: QTCREATORBUG-14583
Change-Id: I60973047e14ce0664c49e802124b51aa23444835
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-16 12:54:11 +00:00
Eike Ziller
054ed354e0 Merge remote-tracking branch 'origin/3.5'
Change-Id: I30148c16cbb66ef670caaf1c74dccff47069bf68
2015-09-15 07:41:02 +02:00
Tobias Hunger
d0a8f5acbf CppTools: Remove unnecessary code from abstracteditorsupport
Change-Id: Ie9032ea494d151a491d37cd5e777f3c2df40f1e2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-14 10:26:31 +00:00
Nikolai Kosjar
915f68deac C++: Revert problematic template specialization changes
This mainly reverts

    commit 81721f6781
    C++: Fix resolving of recursive typedef

    commit 2070431d8c
    C++: Fix resolving of partial specialization

and some bits of other changes due to dependencies. It also reverts

    commit e0594fc9b9
    C++: Fix expensive lookup for boost

which attempted to solve the upcoming problems.

Task-number: QTCREATORBUG-14741
Task-number: QTCREATORBUG-14889
Task-number: QTCREATORBUG-14962
Change-Id: I3f9e1f97199e5199b71da394fc27051c7709bd1f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-09-10 12:00:01 +00:00
Eike Ziller
c868b9f3ed Merge remote-tracking branch 'origin/3.5'
Change-Id: Ife5fdcd71b0adc99d4297a28a64515e9e93d7864
2015-09-04 09:19:28 +02:00
Nikolai Kosjar
169556db2f C++: Fix crash after triggering completion and closing editor
Fix use-after-free for the following case:
  1. Open an editor
  2. Trigger a long processing completion
     (e.g. simulate with QThread::msleep in
      CppCompletionAssistInterface::getCppSpecifics)
  3. ...and immediately close the editor (e.g. with Ctrl+W)
  4. Wait until it crashes.

The completion thread relied on the BuiltinEditorDocumentParser object,
which is deleted once the editor is closed. Fixed by sharing the
ownership of that object between the *EditorDocumentProcessor and the
completion assist interface.

This case came up when doing tests for the bug report below.

Task-number: QTCREATORBUG-14991
Change-Id: I0b009229e68fc6b7838740858cdc41a32403fe6f
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-09-02 12:37:23 +00:00
Eike Ziller
3b1a966cc8 Merge remote-tracking branch 'origin/3.5'
Change-Id: Iebaabfc2f724cd493b7cab025406531cea5cd2dc
2015-09-01 12:57:51 +02:00
Marco Bubke
3114780e55 CppTools: Add CppModelManager::isManagedById
Change-Id: Ica1a33b2619f64746b8671bff2856503775a40bf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:11 +00:00
Marco Bubke
b278dc87ca Clang: Add diagnostics
Diagnostics are now moved to the clang backend process. Fixits are
supported too.

Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:16 +00:00
Nikolai Kosjar
42d8672626 C++: Add tests
...for two regressions that were introduced by

    commit e0594fc9b9
    C++: Fix expensive lookup for boost

Change-Id: I1fa01e626da480ca53e04b4709fec458378e7aef
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-08-31 09:26:00 +00:00
Daniel Teske
b82311024d Open Project: Don't show a error dialog for duplicated projects
Instead, switch to edit mode, show sidebar, scroll to project,
and show a tooltip next to the project.

The tooltip is somewhat easy to miss, but this is a clear improvement
in most cases.

Change-Id: Icd27f76e7d434f33e731b6fd56473ff913986a89
Task-number: QTCREATORBUG-8422
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-08-24 11:29:09 +00:00
Nikolai Kosjar
e0594fc9b9 C++: Fix expensive lookup for boost
With this patch, CheckSymbols takes about 200ms for processing the boost/proto
hello world example [1]. Before, it needed about 11 seconds (timer in
CheckSymbols::run). Same goes for including <boost/fusion/include/zip.hpp>.

The custom ProcessedSet object was added to support "completion for typedefs
for templates in namespaces", but apparently that's not needed anymore, as the
added test proves.

[1] http://www.boost.org/doc/libs/1_58_0/doc/html/proto/users_guide.html#boost_proto.users_guide.getting_started.hello_world

Task-numer: QTCREATORBUG-14889
Task-numer: QTCREATORBUG-14741
Change-Id: I90454e8970a9d04033d56beeb0c6d7a0d4e6cc62
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-08-21 10:25:15 +00:00
Eike Ziller
8eaaef96aa Merge remote-tracking branch 'origin/3.5'
Change-Id: I65968dd02ea6bdd15f304ae567dd0c02238e6949
2015-08-20 13:23:13 +02:00
Thiago Macieira
abec43e7d3 Remove unused function
Found by ICC
builtinindexingsupport.cpp(96): warning #177: function "<unnamed>::WriteTaskFileForDiagnostics::processedDiagnostics" was declared but never referenced

Change-Id: I7de033f80b0e4431b7f1ffff13fa7bd62338aa50
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-17 16:26:24 +00:00
Eike Ziller
8261b98d7e Preferences: Options pages need unique IDs
Since we are referring to them by ID without specifying the category in
addition.
This requirement was implicitly added by
592ffe7377

Task-number: QTCREATORBUG-14742
Change-Id: I7be539127b76de90c19b0282565d845fa42010ab
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-08-10 11:55:01 +00:00
Eike Ziller
cd5f9f6ff8 Merge remote-tracking branch 'origin/3.5'
Change-Id: I7b3ef276d438ff0f184a649153e8aeec08a9f8c9
2015-08-04 13:16:03 +02:00
Nikolai Kosjar
9f2b5eac2d CppTools: Update language standard option for clang
Tested with clang 3.6.

Change-Id: Icd2383bd03b91837b3129045e9ab78a1620efd02
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-08-03 13:52:16 +00:00
Nikolai Kosjar
c6b52267f4 Clang: Fix sending (un)register translation unit
Handle the following use cases:

  1. Editor is opened
    --> Register file at backend.

  2. Close editor for which a project part exists
    --> Unregister file with project part.

  3. Close editor for which no project part exists (anymore)
    --> Unregister file with empty/default project part.

Change-Id: I2b253004a920cccef989876538ab552eacf6b45c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 13:08:32 +00:00
Nikolai Kosjar
2203565cad CppTools: Ensure that ProjectPart::id() != " "
Change-Id: Ic928380f711e58008ed66691137c238598a5c26a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 10:33:05 +00:00
Nikolai Kosjar
a3056e8922 CppTools: Fix removedProjectParts()
It compared pointers, not ids.

Change-Id: Ic77c64e452f8abfe9a35b74591f0f3baeebcf7f0
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 09:49:26 +00:00
Nikolai Kosjar
420bc69739 CppTools: Use project part ids instead of file paths
File paths are not unique since e.g. each qbs group in a file is mapped
to a project part.

Change-Id: I7df3f224dd23046b869f2588b8a34eb26cfc0b1a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 09:49:14 +00:00
Oswald Buddenhagen
ddea5994f3 Merge remote-tracking branch 'origin/3.5'
Conflicts:
	scripts/deployqtHelper_mac.sh

Change-Id: Ia0d5fef8c28e0bfb3b0c703ad3652e2d70d9e7d1
2015-07-17 17:25:26 +02:00
Tobias Hunger
c275dac084 Rename toolchain type constants in ProjectExplorer
Change-Id: I56f5b7373846bb091456c050eb1ff3495ca2dd72
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2015-07-14 14:44:07 +00:00
Tobias Hunger
e6d1141e1e ToolChain: Get rid of type() in favor of typeId()
Change-Id: I8fc68c266acb55a7c3e014697a7b526784914f7a
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
2015-07-14 14:40:03 +00:00
Nikolai Kosjar
418fc32f6a Clang: Do not call DocumentManager::modifiedDocuments() from worker thread
This is unsafe.

Change-Id: I8ac075a7289afa0d84785e37b1325d186a153000
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-10 14:04:19 +00:00