aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangformat/clangformatutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clang: Build against LLVM/Clang 9Nikolai Kosjar2019-10-181-0/+4
| | | | | | | | | Task-numer: QTCREATORBUG-23038 Change-Id: I3608bca6541614bb55e67d35c87334957cd02761 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Konstantin Tokarev <annulen@yandex.ru> (cherry picked from commit 6ec8017bc675692f3d325c0cd95c9c4c7a79db7d) Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Avoid more deprecation warningshjk2019-07-051-2/+2
| | | | | Change-Id: Icc7bb7a4ccf7fc9f89f6f668c194ccd440e5231c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-281-13/+13
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* More FileName::pathAppended()hjk2019-05-201-9/+9
| | | | | Change-Id: Ie20ec34ea9712b3ec49e6233b23cef84c2019f03 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Some more FileName::appendPath() -> pathAppended() changeshjk2019-05-171-2/+2
| | | | | Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangFormat: Fix UI issuesIvan Donchevskii2019-04-261-0/+26
| | | | | | | | | | | - 'Default' values remain so after save/load - the language is fixed to C++ - the project settings are shown correctly - fix parsing configuration file - do not trigger slots when we fill the table Change-Id: I91b477721b5084803324cd38d0cfeb9d5650dd9f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Use the global style if no configuration is foundIvan Donchevskii2019-04-021-2/+5
| | | | | | | | | | | If no .clang-format file can be found and the settings do not override the configuration neither globally not in the project then construct the global settings (if required) and use them instead of constructing the style every time. Task-number: QTCREATORBUG-22144 Change-Id: Ib59b7f166f030ce3fb085f105f30fbf0eb25b185 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix GCC8 warningsOrgad Shaneh2019-04-011-21/+0
| | | | | | | | | | | * Missing return (false positive. All enum values are covered). * Unused static function. Amends commits 7f0589ef591f6ff08a86ec6bca02248dc40443ef and 40fcc728b240ed5d4ad93de588537dd48d284183. Change-Id: I0e5c4ae09739a7ca9edbbbbe3f081d8a732245e7 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangFormat: Fix the filepath to actually pick the selected configIvan Donchevskii2019-03-121-0/+7
| | | | | | | | | | We've searched for the config we want to use but did not change the path for the source file which is used internally by libformat to find the configuration. Fixes: QTCREATORBUG-22048 Change-Id: Ibdcc33ac338f06e966dfc5c06cdb38db3bb768b6 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Use by default the same style as Qt Creator usesIvan Donchevskii2019-03-071-51/+104
| | | | | Change-Id: Iae0f774873f66fcd4e297cfc260a8541f4373e36 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Add context menu item to open current config fileIvan Donchevskii2019-03-071-0/+5
| | | | | | | | | Add the context menu item to C++ editor which allow you to open the currently used .clang-format configuration file. Change-Id: If9d6bec4f4085c18b13df15d78417aee82ddb4e4 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* ClangFormat: Try to use existing file to override settingsIvan Donchevskii2019-03-061-10/+26
| | | | | | | | | If there is a .clang-format file in the project use it as a base for the custom file that creator uses to override the project settings. Change-Id: I0786dbdd6077b87d4dd428981e24d503668f1031 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Change the logic how configuration is pickedIvan Donchevskii2019-03-051-30/+62
| | | | | | | | | | | | | | Let's use by default the configuration that clang-format picks itself for the source file. The Qt Creator configuration will now only override the default one with global or project settings and can be turned off with the checkbox. This behavior is clearer than always picking some configuration which Qt Creator prefers best. Change-Id: If5ed3d67eb6b4b47a6d0fd5259f7efbb608914d1 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* ClangFormat: Fix configuration files handlingIvan Donchevskii2019-02-221-14/+58
| | | | | | | | | | | | | | 1. Fallback to the base style from the invalid config file: If the .clang-format file from the earlier clang version is used and can't be parsed by LibFormat try to find a base style and generate the updated config based on that information. 2. Do not create new .clang-format configuration for each project. Rely on the global one until the user explicitly creates the configuration for the project. Fixes: QTCREATORBUG-22004 Change-Id: I75bd89eebc3ebae57c1f1de94da2e78924ae510c Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Fix applying global settingsIvan Donchevskii2019-01-241-6/+8
| | | | | | | The actual apply() method was never called for the widget. Change-Id: Idff194a36591db437cbe5695377005ed5a0b25d4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Use relevant settings for each fileIvan Donchevskii2018-11-141-31/+30
| | | | | | | | | | | | | Existing Clang Format settings may not follow the project/global pattern but can be expected to be used for the indentation/formatting. So let's proceed with UI for global/project settings but use global settings only if there's no configuration found for the current file. Change-Id: I87c25ab3feb7e2e3deb0290848088657783cf972 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Use the constant for the configuration filenameIvan Donchevskii2018-11-131-2/+4
| | | | | | | | It is unlikely that this name changes but let's follow good coding practices. Change-Id: I12adbf155f26b1b3a02d07092fcc113e0c5157e6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Improve current style detectionIvan Donchevskii2018-11-131-2/+9
| | | | | | | | Check first if the current project already has .clang-format configuration file. Change-Id: Ic8cb5d37c32cd5b0c04485589caea95de933c264 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Set BreakBeforeBraces to Custom by defaultIvan Donchevskii2018-11-131-0/+2
| | | | | | | | | | | | If it's not set to custom some user settings are continuously overridden which is not always expected. Previously the default style caused some parameters to be reset. Change-Id: Ie0fedf6b9984116a86b7c588aed8c6b6cb35133e Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Allow to check whether project code style existsIvan Donchevskii2018-11-121-3/+3
| | | | | | | | | | | The calling code can anyways fallback to the global style without extra help if no project style exists. It is useful when you want to get the project style if it exists and understand at the same time that it is not a global one. Change-Id: I265de3f436f90623385427fc8a1abad09c8c3577 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangFormat: Synchronize with C++ code style settingsIvan Donchevskii2018-11-081-0/+179
And remove UI for default code style settings because it does not affect anything when ClangFormat plugin is enabled. Change-Id: Ie348b7d2691b09ea2b4868da987f2a27347ea0f3 Reviewed-by: Marco Bubke <marco.bubke@qt.io>