summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/compileroptionsbuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-901/+0
| | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.0'Eike Ziller2021-08-261-3/+17
|\ | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs src/plugins/android/androidconfigurations.cpp Change-Id: If8dc2cdf131811e08ca147c6f58dbb3ed3bf7227
| * CppTools: Code model fix for C++20, MSVC, and newer CMake versionsCristian Adam2021-08-201-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | Starting with version 3.20 CMake adds -std:c++20, which breaks the code model when using MSVC. Clang-cl 12 doesn't know about -std:c++20, but clang driver knows about -std=c++20. Fixes: QTCREATORBUG-26146 Change-Id: I696842e11b0a9ba8849455d2f81f8dde6dd95a27 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* | ClangTools/CppTools: Code cosmeticshjk2021-08-181-38/+30
| | | | | | | | | | | | | | Mostly namespaces. Change-Id: Ife8bbcb128344cf56d444da8f9d76b1204b9fe34 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | ClangTools: Proliferate use of FilePathhjk2021-08-181-1/+3
| | | | | | | | | | Change-Id: I3eb16546a729ab01c10e37572adac9aef83f5cd4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppTools: Turn some classes into pure value typesChristian Kandeler2021-08-131-2/+2
|/ | | | | | | | | | | | | ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers to Project and/or Toolchain, even though they were used in contexts where these pointers were either unsafe to access or not guaranteed to be valid anymore, which made their use difficult and error-prone. We turn these classes into pure value types by copying in all relevant information before the first async operation takes place. Fixes: QTCREATORBUG-25678 Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* ClangCodeModel: Prefer ui headers from ExtraCompilersChristian Kandeler2021-07-021-0/+5
| | | | | | | | | ... to the ones from the actual build. The former are generally more up- to-date. Fixes: QTCREATORBUG-25937 Change-Id: I20859de9816457c340d9e1ec6a3008c536537d8b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ICore: Change some path API to use FilePathEike Ziller2021-04-261-1/+1
| | | | | | Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Use qAsConst with non-const Qt containers in range-loopsAlessandro Portale2021-02-171-3/+3
| | | | | | | ... in various places Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CMakeProjectManager: Fix issues with precompiled headersCristian Adam2021-01-141-35/+17
| | | | | | | | | | | | | | | Clang code model can break if CMake project uses precompiled headers. QtCreator will make a copy of the precompiled header, this way it will not conflict with the build system one. Ammends 888ea6bbbb0f4c6bb6b5616046e600b9520e4faf Fixes: QTCREATORBUG-24945 Fixes: QTCREATORBUG-25213 Change-Id: I149fc416cd047683d095758a024de47c7baf681c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.14'Eike Ziller2020-11-301-4/+4
|\ | | | | | | | | | | | | Conflicts: src/plugins/projectexplorer/gcctoolchain.cpp Change-Id: I2136ba89d3aa3c4c2a0e7a4f9d8ba9cec32924ce
| * CppTools: Work around problems with our definition of __FUNCSIG__Christian Kandeler2020-11-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | This basically extends the existing hack to cover one more case. It may very well break again in some other context, in which case we will remove the custom definitions entirely, as the reason they exist in the first place does not seem terribly relevant. Fixes: QTCREATORBUG-24580 Change-Id: I757ac23682c81c647a5d968fa549baac5716010c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
| * ClangTools: Use built-in header paths againChristian Kandeler2020-11-271-1/+1
| | | | | | | | | | | | | | This was broken in 7b6ab79f3e. Change-Id: I037474ecce62bfebfe167d8dce15a6e7dbf7a001 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge remote-tracking branch 'origin/4.14'Eike Ziller2020-11-191-0/+1
|\ \ | |/ | | | | Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
| * CppTools: "CLANG-UPGRADE-CHECK: Update known language features macros."Alessandro Portale2020-11-181-0/+1
| | | | | | | | | | | | | | Clang++ 11 has __cpp_constexpr_in_decltype Change-Id: I450a79f2af8cd6aca51b95b11b3c06b9682c0418 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CppTools: Take "-include" files into accountNikolai Kosjar2020-11-051-0/+22
|/ | | | | | Fixes: QTCREATORBUG-20602 Change-Id: Ibfc518fc64ed75f93265db800558ec1d2e424bb4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangTools: Do not include our wrapped Qt headersChristian Kandeler2020-10-281-1/+2
| | | | | | | | | These are only necessary for the code model and can prevent clazy from finding certain issues. Fixes: QTCREATORBUG-24845 Change-Id: I04ba6703812918c39ebbde1dbac5af85fe18622d Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.13' into masterEike Ziller2020-09-031-1/+13
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ListViewSpecifics.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/MouseAreaSpecifics.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FlickableSection.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontSection.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml Change-Id: Ie5deacd39ae4f3c0966e7cb41a8fd832dcefbb09
| * Clang: Add conditions for adding exceptions flagOrgad Shaneh2020-09-021-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | For GCC it can be deduced from the compiler flags, so no correction is needed. For MSVC it can be deduced from the detected defines. Amends 26693e82126de15145a04c3428a10f6c15120532. Change-Id: Ie4850f328a2afdb3e5158c58f8c30a2644d9c592 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Merge remote-tracking branch 'origin/4.13' into masterEike Ziller2020-08-251-3/+4
|\ \ | |/ | | | | Change-Id: Ib60df85a85fc1c94d8cc0dc23ea9fcdb4822bcab
| * CppTools: Do not ignore "built-in" compiler macros for custom toolchainsChristian Kandeler2020-08-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Built-in compiler macros are normally not passed to the code model, because of potential conflicts with clang. However, in the case of custom toolchains, these macros are provided by the user for the explicit purpose of making them known to the code model. Another exception are the bare metal toolchains, for which we now make sure we won't get out of sync when new ones are added. Fixes: QTCREATORBUG-24367 Change-Id: I2a0458d9132fdff15eb9adfcb2c06d7ef72508bc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | clang: Fix include/resource dir confusionChristian Kandeler2020-08-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | The getClangResourceDirAndVersion() function in ClangTools could return the actual resource dir or the include dir, depending on the input. This mistake happened because of misleading names spread all around the code. Now the function returns what it says, and the other names are accurate as well. Change-Id: I0a8600857ee7b9fafb16256e0d1ad203ac3273d2 Reviewed-by: David Schulz <david.schulz@qt.io>
* | Utils: Drop Utils::SkipEmptyParts againhjk2020-07-211-1/+1
|/ | | | | | | | We require Qt 5.14 nowadays. Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Clang: Fix error when including float.h with mingwChristian Kandeler2020-07-091-16/+33
| | | | | | | | | | | Prevent mingw from trying to #include_next a private header from a path we cannot add to our list of includes. Fixes: QTCREATORBUG-24251 Task-number: QTCREATORBUG-24027 Change-Id: I18a9db130b9c2265cd208c3506d08d2e1c4cee45 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Core/Utils: Migrate further to Utils::Idhjk2020-07-061-1/+1
| | | | | | | | The coreplugin/id.h header is kept for downstream for now. Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66 (cherry picked from commit 430a33dcd9ac80ddb848e41f8f059102857c88aa) Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Fix Qt 5.15 deprecation warnings for QString::SkipEmptyPartsChristian Kandeler2020-06-161-1/+2
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: I03ee6811df4346754bbd652f2c3c97477f9cdb7e Reviewed-by: hjk <hjk@qt.io>
* CppTools: Fix code model with clang and precompiled headersChristian Kandeler2020-03-091-7/+5
| | | | | | | | Amends a1d22fd2f7. Fixes: QTCREATORBUG-22897 Change-Id: Iaadf72d78e11279c8dd553860e00be9d29135752 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Merge remote-tracking branch 'origin/4.11'Eike Ziller2020-01-031-0/+12
|\ | | | | | | Change-Id: I0657cee6b87eea7b3178548bebed85d5ac824519
| * Revert "Clang: Stop enabling exceptions explicitly"Nikolai Kosjar2019-12-201-0/+12
| | | | | | | | | | | | | | | | | | This reverts commit b114f77d8a633341b617a5cadd04e5977beae65d as "--driver-mode=cl" apparently still disables exceptions. Task-number: QTCREATORBUG-23000 Change-Id: I9c49d971fafda5e1aca8445f8921e50f323d368f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* | Clang: Use toolchain macros for IAR toolchainNikolai Kosjar2019-11-281-0/+7
|/ | | | | | | ...or if requested with QTC_CLANG_USE_TOOLCHAIN_MACROS=1. Change-Id: I6d2f35b69393a7039271cc651aa514cdb686522e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Fix code model for Clang buildsCristian Adam2019-11-011-1/+6
| | | | | | | | If you build Qt Creator with CMake version 3.16, you will have precompile headers which will break code model. Change-Id: I679936faed39ecfedb9ebb5fb553449a9f5ea29d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Remove duplicated targets argumentsNikolai Kosjar2019-10-221-0/+10
| | | | | | | | | | We always set the target explicitly (in a certain way), so exclude the target arguments coming from the build system and the (possibly manually specified) platform codegen flags of the toolchain. Change-Id: I74bbec67f5960f05b50cf9c5aa11875c71a5161f Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Ensure that platform codegen flags get also filteredNikolai Kosjar2019-10-221-3/+2
| | | | | | | | | | | | Leave the function addExtraCodeModelFlags() around as it's used by ClangPchManager::ProjectUpdater::toolChainArguments(). This allows us to filter out excess target arguments in a follow-up change. Change-Id: I742d713dd1ca6c391ba77c52555dcf4e94cc2ff9 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Make code model on "cl" mode more robustCristian Adam2019-10-021-0/+9
| | | | | | | | | | | | | Unknown command line options starting with / are now transformed into commands starting with -, which will cause unknown commands warnings in libclang. The / commands cause errors because they are treated as missing files. Fixes: QTCREATORBUG-22871 Change-Id: I75f7878ab6a7951df24c954ccff1c298ea65f839 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Do not use PCH when build PCH artifacts exist closebyCristian Adam2019-09-301-4/+19
| | | | | | | | | Clang cannot handle gcc pch files which are close to the forced include header. Fixes: QTCREATORBUG-22888 Change-Id: I0d678a889d1fb62bf3c6850277e13271efb91eea Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Move QtVersion and BuildTargetTypeEike Ziller2019-09-101-1/+1
| | | | | | | | | | | | | QtVersion to utils/cpplanguage_details.h which already contains similar flags. BuildTargetType to ProjectExplorer, next to BuildTargetInfo (but not in the same header to not pull that in everywhere). Removes dependency on ProjectPart from RawProjectPart. Change-Id: I5791065e4266f20c2657ee4b1b594df04b238a1c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Ignore -f[no-]keep-inline-dllexportNikolai Kosjar2019-06-261-1/+8
| | | | | | | Fixes: QTCREATORBUG-22452 Change-Id: Ic17e6331e92f23c31f4f7319257f2d09c66af8a4 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Handle not only "-std=X" but also "--std=X"Nikolai Kosjar2019-06-251-1/+1
| | | | | | | Fixes: QTCREATORBUG-22444 Change-Id: Iedb0b17a26724d0cc8233a3bad273f3e6bd7462d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Fix build with clang-8Ivan Donchevskii2019-04-171-0/+1
| | | | | | | | | | Clang-Tidy checks and Clazy flags updated. CLANG-UPGRADE-CHECK done. Change-Id: I1ca585c5c3c77a7f183719df9c262603150914e8 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Minimize reindexingMarco Bubke2019-04-021-0/+2
| | | | | | | | | | We optimal indexer is only reindexing if the index would be changed. This patch is a step in that direction. We only reindex now if the file or project has changed. It fixes some typos too. Task-number: QTCREATORBUG-21150 Change-Id: I6ea1c13282fbcd70253b9b2939aed37580dbd160 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Improve compilation database generationIvan Donchevskii2019-03-131-1/+1
| | | | | | | | | | Do not use CompilerOptionsBuilder anymore because we don't need much tweaking for projectPart data and can do it better specifically for the generator. Fixes: QTCREATORBUG-21936 Change-Id: I00ad872c703598a9a88af29399b428520dd5cb3b Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Fix language version detection with PCH-s in CMake enabledIvan Donchevskii2019-03-111-0/+9
| | | | | | | | | Filter out the PCH flags when detecting macros and language version. Fixes: QTCREATORBUG-21860 Change-Id: I25c63f1409c16db3623d1c8f43ffd5d2bd0f6748 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* CppTools: Allow to black list command line flags from projectNikolai Kosjar2019-02-121-0/+8
| | | | | | | ...for debugging and workarounds if necessary. Change-Id: If76cddb59fbd8e96f42d141bd5e5d03cd88ab30f Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Allow to forward warnings flags from build systemNikolai Kosjar2019-02-051-3/+6
| | | | | | Change-Id: I47ebb1ce4f3b5544408eb1d0f891ed5090394282 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix parsing files with Android toolchainIvan Donchevskii2019-01-241-1/+17
| | | | | | | | - filter out include paths from command line flags - do not search for MinGW parent toolchain in Android toolchain Change-Id: I5f2566aa0bd10eb939380193e64e17b000743b73 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Fix how tweaked header paths workIvan Donchevskii2019-01-231-17/+12
| | | | | | | | | | We need to provide built-in includes only when we use tweaked headers. Also let's require Clang resource directory because it has to be placed on the specific position inside the built-in header paths. Change-Id: Id581238660c680725201de759216cf33f69f6cc7 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* PchManager: Split pch tasks in project and system pch tasksMarco Bubke2019-01-211-0/+6
| | | | | | | | | | | | | | | | | | | Like you can see in the task numbers this patch is touching many different areas. So I will only touch the main parts. It is using a clang action instead of an extra process which will be enabling the handling of generated files in PCHs. The flags from the project part are now not anymore transformed in a command line but they are saved in the container semantically aware so that they can later be merged. Most of this patch is simply polishing of other patches. Task-number: QTCREATORBUG-21346 Task-number: QTCREATORBUG-21380 Task-number: QTCREATORBUG-21382 Task-number: QTCREATORBUG-21383 Task-number: QTCREATORBUG-21693 Task-number: QTCREATORBUG-21778 Change-Id: I9b0c02d8149b554254e819448fbc61eeaa5b7494 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Do not QTC_ASSERT when file kind is not setIvan Donchevskii2019-01-211-1/+1
| | | | | | | | We do not set file kind when building an initial command line for libclang and this assert triggers all the time. Change-Id: If607cf68ca5bcd788abe77875787bed24db57573 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-3/+3
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Fix incorrect QTC_ASSERTNikolai Kosjar2019-01-171-1/+1
| | | | | Change-Id: I1c7bd599cc121484b4d33723123f34981c675407 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>