Commit Graph

5 Commits

Author SHA1 Message Date
Nikolai Kosjar
ed8b910202 Clang: Honor fixits own locations in ClangFixItOperation
The fixits have own ranges/locations and thus might address more than
one file.

Change-Id: I5ee59944bef588e763a91f054a60823593373a0e
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-07-08 08:22:37 +00:00
Nikolai Kosjar
46840046df Clang: Honor fixits own locations
...when showing the refactoring marker and generating the quick fix
operations.

Opening main.cpp

  main.cpp:
   #include "file.h"
   void f(char *s) { foo(s); }

  file.h:
    // significant line 1
    // significant line 2
    // significant line 3
    bool foo(int fd);

led to

    SOFT ASSERT: "textBlock.isValid()" in file
    clangdiagnosticmanager.cpp, line 205

and a misbehavior when applying the fixit from the tooltip.

We take the line of a diagnostic to display the fixit marker if it has
any fixits. But the (child) diagnostic might be issued for an other file
(that's what happening here), so better take the line of the location
where the fixit is meant to be applied.

Same applies for generation of the quick fix entries.

Change-Id: I48d38420b285d2d2f86e3faa2319513aa8b47848
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-28 11:08:08 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Nikolai Kosjar
ca63359386 CppTools/Clang: Clean-up of includes
Change-Id: I0ba340dcf0ee23e61588f17262d07e7088751836
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 13:15:38 +00: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