Behavior was: The field became "LLVM" after a change to another style.
Fixed behavior: BasedOnStyle field becomes and stays chosen style.
Change-Id: I0d41a216f7f06c5681cc20a52c736406307a3724
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Added test checking behavior when after Q_OBJECT all class structure
have correct indenting and redundent tabs doesn't appear before key words
such as public:, private: , etc.
Made automatic addition Qt defines to StatementMacro to .clang-format files.
Fixes: QTCREATORBUG-26776
Change-Id: I3490421a9caf2831b593939597940358f7ce8f01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Some Linux distributives provides moders clang without separate libs
compiled, like libClangTooling and so on. Just provide libclang.so and
libclang-cpp.so.
Qt Creator provides way to handle such clang installation by
pointing flag CLANGTOOLING_LINK_CLANG_DYLIB=On for CMake. But
ClangFormat still keeps from building. Fixed it.
Change-Id: Id420f82c47c4205c8cd631aa04be6771628984be
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.
Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Using LLVM10 is minimum supported, but some format style
elements have been introduced later, so guard access to
members that are not present in LLVM10.
Amends a997161dd6.
Change-Id: I9513b4fdc1fa5247cd67beaf0122b1b1d5494bbf
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Added synchronization between ClangFormat codestyle settings and
CppEditors codestyle settings. All changes which will be done in
ClangFormat settings tab settings tabs will be automatically
retranslated to CppEditor codestyle settings tabs and vice versa.
Change-Id: I408d726c12552856e3c1b72d3ba09b77fff83321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
In favor of the FilePath/Link ones.
Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
- Move ClangFormat settings page to TabWidget in the dialog
that opens when a user press "Edit" button in the CodeStyle tab
Change-Id: Ibd285344f07a6b2b20e275f2134976c50f91a019
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
- Fixed behavior when saved data from file doesn't load
in the first opening of the code style options
Change-Id: I1c72845cbf8119f9eb402a2f40bcc816c5590c25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
- Move logic work with clang-format file to
additional class to make clangformatconfigwidget
responsible only for work with ui elements.
- Fix functionality: when new BasedOnStyle was
chosen all fields were empty or set in default,
now it fills with the corresponding value.
Change-Id: I2ee42a502e87da761274d293a7f0a38fda98804d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.
Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Otherwise, we could introduce unwanted syntactical constructs, for
instance if the previous character is an asterisk.
Fixes: QTCREATORBUG-25966
Change-Id: Ic0b535861bc1cb4f5f93d06bb11d0f3c7c583893
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
In indentation-only mode, any edit that adds or removes newlines is
wrong by definition.
Change-Id: Ida6e729f4d5e8dcd7893fb2bb9407e596661f942
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Saves some code on the user side.
Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Apparently, we can prevent clang-format from removing line breaks by
adding an empty comment at the end of the line.
Change-Id: Ia78ecb9e7351d059c544cbda11d33af5734e2218
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
And implement it in the clang-format plugin to use the ColumnLimit from
the style. This would be quite useful if you're working on different
projects with a different ColumnLimit. This way you get an visual
representation and do not only have to rely on clang-format.
Change-Id: Ib0258e3fba6f45f0f46ce612f806527a47868ad9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Make the static LLVM in ClangFormat really internal to the ClangFormat
plugin on Linux by not exporting symbols from it.
This was missed during the conversion of the qmake project to CMake.
Fixes: QTCREATORBUG-24998
Change-Id: If483f3c45d5cf7f63e7b8dde58efab6371414bdd
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
The plugin builds just fine and should be mostly (fully?) functional with
upstream clang, so it seems excessive to force-disable it entirely for
everybody not using our custom patch.
Change-Id: Id6a179c20325290a8205218c9514a16c1adc9076
Reviewed-by: hjk <hjk@qt.io>
The ClangFormat plugin needs to link against clang-cpp in that
case as well.
Fixes: QTCREATORBUG-25138
Change-Id: I84b1784b291d8944a9dee66ec14db32ad72ff8b5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Parts of QC cannot be linked against a release build of clangTooling
libs and vice versa when building on Windows.
Check whether the provided libs match the current build mode and
disable respective parts if necessary.
Re-use this information to decide whether unittest should be build
or not.
Change-Id: Ibc2aab0d7886e78ebbf8f15a43152efad49f1eff
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Silence the following warning:
warning: missing initializer for member
‘clang::tooling::IncludeStyle::IncludeCategory::SortPriority’
[-Wmissing-field-initializers]
118 | style.IncludeStyle.IncludeCategories = {{"^<Q.*", 200}};
According to the docs of IncludeCategories, the SortPriority field
is optional, and when not set its value is set to the value of
Priority field. So in order to fix the warning we repeat the same
value for SortPriority field.
In addition we ensure that we require at least clang version 10.0.0.
Change-Id: I8baae7a33ad1a7a7f3afe66779f482b29a7396b4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Apparently, the MSVC linker gets confused if an input library
("clangFormat.lib") has the (almost) same file name as an output library
("ClangFormat.lib"), even though the latter is specified with an
absolute path.
Change-Id: Ia76e60fd10e16ce8daff880f4005d40d7f20d08c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
When vanilla LLVM/Clang is used the #warning statement
causes actually an error on MSVC.
Change-Id: Id3f36efc1b21d48e52a9c44036b99a5b4d9a0d5c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>