summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/compileroptionsbuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* CppTools: Do not use -isystem for header paths in the repositoryOrgad Shaneh2018-06-111-3/+12
| | | | | | | | | | | | Clang uses mmap for system headers. This locks the header files on Windows. If the project file is not in the root directory of the repository, and it uses header files that are outside its directory, but in the repository, Git operations like checkout, rebase etc. can fail because the header files are locked. Change-Id: If8a258234479fc70ca0a8384bf24c68d767dbeaa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Use QFileInfo instead of QDir for clang executable pathIvan Donchevskii2018-05-251-3/+3
| | | | | | | | QDir::exists() returns false for files which is not the intended behavior. Change-Id: I768432df93e10b3f8f570da4d94035038ff52e06 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.6' into 4.7Eike Ziller2018-05-141-3/+9
|\ | | | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp Change-Id: I873a2fa112321225e7b478739fc017b01d24ce18
| * CppTools: Rollback some changes in CompilerOptionsBuilderIvan Donchevskii2018-05-031-6/+8
| | | | | | | | | | | | | | Make it safer in the 4.6 release. Change-Id: I75857ecc08af8febe40fd75dc94d8ab986d4b768 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
| * CppTools: Fix MSVC toolchain flags for C-filesIvan Donchevskii2018-05-031-5/+9
| | | | | | | | | | | | | | | | | | | | In case of C-header or C-source files the MSVC language version was not switched to C. Fixes static analyzer runs for C files. Task-number: QTCREATORBUG-20198 Change-Id: I1da31a1048b7c258642cf00f5084681f5d384ee6 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* | ClangTools: Remove clang executable settingsIvan Donchevskii2018-05-041-4/+13
| | | | | | | | | | | | | | | | We use custom clang executable and it does not make sense anymore to give a choice of changing it. Change-Id: Icf86042ac3fcd08c320ef2bbdaabef1102b023b5 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Utils: Purge qtcfallthrough.hOrgad Shaneh2018-04-091-1/+0
|/ | | | | | | No longer needed. Change-Id: I9b0bee014df89d4c567f1d2431b5ff9404f5f925 Reviewed-by: hjk <hjk@qt.io>
* CppTools: Use -isystem only for non-project includesIvan Donchevskii2018-01-261-3/+25
| | | | | | | | | | | ...and return -I for ones in project. In case -isystem is set for all includes we don't get proper reparse when the included file is in angle brackets and is changed. Change-Id: Iba912edfc488aed2a4484f6a742a7c36099e8a13 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ProjectPart: save codegen flags in project partIvan Donchevskii2018-01-101-0/+9
| | | | | | | | | | | And add them to other clang code model arguments. These flags provide architecture for cross-compilation when ios kit is selected. Task-number: QTCREATORBUG-19437 Task-number: QTCREATORBUG-19430 Change-Id: I7a485f49d637371bb28b2096086d7d8a4b0c404a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Merge remote-tracking branch 'origin/4.5'Eike Ziller2018-01-091-12/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/cpptools/clangcompileroptionsbuilder.cpp src/plugins/cpptools/clangcompileroptionsbuilder.h src/plugins/cpptools/compileroptionsbuilder.cpp src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp src/plugins/qmlprofiler/qmlprofilerclientmanager.h src/plugins/qmlprofiler/qmlprofilertraceclient.cpp src/plugins/qmlprofiler/qmlprofilertraceclient.h src/shared/qbs Change-Id: I364ababc5d41046d17e999096c4a7187c4e4e010
| * Clang: macOS: fix unknown integer typesIvan Donchevskii2018-01-031-10/+7
| | | | | | | | | | | | | | | | | | | | | | Always exclude clang include paths which do not come with libclang used by code model. This solves the issue with GCC that uses system clang include folder on macOS. Task-number: QTCREATORBUG-19397 Change-Id: I3b4845248a3cf03a95fbd4038856f8fb31346bfa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: always use -isystem for compiler options builderIvan Donchevskii2017-12-141-3/+5
| | | | | | | | | | | | | | | | | | We always provide the full includes list ourselves so it will not change the includes order. Change-Id: I84ee2ca7f05bfb71ae400f0e9e0b8f52810252b3 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: Remove unused functionNikolai Kosjar2017-11-221-6/+0
| | | | | | | | | | Change-Id: Ia76e8cf523b301865d902a3768439a648c23da01 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Clang: Android: fix clang code model errorsIvan Donchevskii2017-11-221-9/+3
| | | | | | | | | | | | | | | | | | | | | | Add missing gcc include directories in Android toolchain. This introduces the similar "magic" that we have in qmake (*qtsource*/qtbase/mkspecs/common/android-base-head.conf) but allows us to have those paths wherever we use android toolchain. Change-Id: I5740f1f2339fd30670567f24db2be2454f665f41 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* | Clang: StaticAnalyzer: use the default compiler options builderIvan Donchevskii2017-11-221-6/+13
| | | | | | | | | | | | | | | | Analyzer has clang path and can generate necessary header paths to be able to use default options builder. Change-Id: I9bb1fc158f045f6e099817c5557ee7d9e38416fb Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Merge remote-tracking branch 'origin/4.5'Eike Ziller2017-11-211-0/+7
|\ \ | |/ | | | | | | | | | | | | | | Conflicts: src/plugins/clangcodemodel/clangutils.cpp src/plugins/cpptools/clangcompileroptionsbuilder.cpp src/plugins/cpptools/compileroptionsbuilder.cpp Change-Id: I0728f08171103259407bbbb35f93b70c2f2e18d0
| * Clang: Define __FUNCSIG__ and others for msvc toolchainIvan Donchevskii2017-11-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Affects __FUNCSIG__, __FUNCTION__ and __FUNCDNAME__. By default Clang can't concatenate strings under those macros with other strings. Because of that we need to define them with empty strings to make clang compile such cases without errors. Task-number: QTCREATORBUG-19295 Change-Id: I9a3770ebe56b4b8a49ba9982c5a1ba90c8f0b304 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: Require LLVM/Clang >= 5.0.0Nikolai Kosjar2017-10-271-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...for the code model parts and declare 5.0 as the supported version for the clang static analyzer. Adapt versions and tests, remove code assuming clang <= 5.0. LLVM/Clang 5 was released on 07 Sep 2017. Task-number: QTCREATORBUG-18931 Task-number: QTCREATORBUG-18657 Task-number: QTCREATORBUG-17187 Task-number: QTCREATORBUG-14881 Change-Id: I53b00258ca06a1d2e57f9379dacc54b310687295 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* | CppTools: merge CompilerOptionsBuilder with Clang oneIvan Donchevskii2017-10-231-1/+90
| | | | | | | | | | | | | | Since it's never used for other compilers. Change-Id: I9512692d1dc9f9a701ea2453b7d50005478bed5d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: Add more CLANG-UPGRADE-CHECK markersNikolai Kosjar2017-10-231-2/+2
|/ | | | | | Change-Id: I9ee553f29fa7a7f60291e2d7d2a56062dc722b9d Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Unify compiler options buildersIvan Donchevskii2017-09-221-16/+1
| | | | | | | | Make build command the same for all builders. Minimize differences. Change-Id: I1cfe5071b3afb4944ed178fff1e57d3aee45d8a9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Convert macros from plain QByteArray to a vector of structsMarco Bubke2017-09-141-64/+38
| | | | | | | | | | | The old code model expected the macros as C++ formatted text ("#define Foo 42) but newer targets like the Clang codemodel expect key value arguments like "-DFoo=42". So instead of parsing the text again and again we use an abstract data description. Task-number: QTCREATORBUG-17915 Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Add Q_FALLTHROUGH for Qt < 5.8Christian Kandeler2017-07-171-3/+7
| | | | | | | | | | | | | | ... and make use of it. With gcc 7, the new option -Wimplicit-fallthrough is introduced and added to the -Wextra set, triggering dozens of warnings in our sources. Therefore, we annotate all obviously intended fall-throughs. The ones that are still left are unclear and need to be checked by the respective maintainer. Change-Id: I44ead33cd42a4b41c28ee5fcb5a31db272710bbc Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.3'Orgad Shaneh2017-06-261-0/+1
|\ | | | | | | Change-Id: Ib5405ed2c3356f65b49fe2f454f8ac2e0de44ef6
| * Clang: fix intrinsic errors with boostIvan Donchevskii2017-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | Add extra define not to include intrinsic headers from boost headers. Task-number: QTCREATORBUG-16439 Change-Id: I887fe63e2560afebdbe9f3d3587f99f95d408997 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Merge remote-tracking branch 'origin/4.3'Orgad Shaneh2017-06-201-1/+1
|\ \ | |/ | | | | Change-Id: I126f3a05212a3d5df78812e66285bc9e8078360b
| * Clang: substitute __float128 with short instead of voidOrgad Shaneh2017-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | There is an argument of this type in std_abs.h. void argument is invalid. Replacing with float, double or long double causes an error in type_traits, which has template specializations for __is_floating_point_helper for all these types. Change-Id: Ife95fa992cbf9684bc67a2098d6609a9a925d015 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Clang: Add CLANG-UPGRADE-CHECK markerNikolai Kosjar2017-06-161-1/+2
|/ | | | | | | ...for things to watch out on an upgrade. Change-Id: I75b77a3c8fa238939b625d084c7db220ab429319 Reviewed-by: David Schulz <david.schulz@qt.io>
* Remove spaces in initializer listsTim Jenssen2017-02-221-1/+1
| | | | | | | Format initializer lists code style like. Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013 Reviewed-by: hjk <hjk@qt.io>
* CppTools: Distinguish between ProjectFile::{unclassified,unsupported}Nikolai Kosjar2017-02-021-0/+1
| | | | | | | | | There was no way to determine whether ProjectFile::classify() was run or not. Now, ProjectFile::classify() returns ProjectFile::Unsupported instead of ProjectFile::Unclassified. Change-Id: I660d0e42044bdefcac38058c6f4a3425983a6d93 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Clean up ProjectPartNikolai Kosjar2016-12-131-2/+2
| | | | | Change-Id: Ia7969ceb52ffb25e7c63b24bc33b091001e9b50a Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang: Take precompiled headers into account when parsing source filesDenis Klychkov2016-11-161-2/+25
| | | | | | Task-number: QTCREATORBUG-15590 Change-Id: Icbfce4ffd6e9f9802641d35d898fa1dc1c4c18ee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Avoid parsing unknown gcc 6 asm output flagsNikolai Kosjar2016-11-011-0/+7
| | | | | | | Task-number: QTCREATORBUG-17183 Change-Id: I24321cd97acfa3dd71a3682f14af4816bdd08059 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Clang: Avoid parsing unknown __builtin_va_arg_packNikolai Kosjar2016-11-011-0/+10
| | | | | | Task-number: QTCREATORBUG-17185 Change-Id: I72552bcd417c9760413b772593642e3c79f1ab17 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang*: Workaround parsing mingw's <type_traits> with clang 3.9Nikolai Kosjar2016-10-181-0/+8
| | | | | | | | | | | | ...for -std=gnu++0x. Define the unknown identifier/type "__float128" so at least the headers can be parsed successfully. Of course this does not help for parsing client code referencing that identifier, but this should be the less common case. Task-number: QTCREATORBUG-17126 Change-Id: Id321311713029d8aa77e068b02361d86debfada6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Avoid running into gcc/mingw intrinsicsNikolai Kosjar2016-10-181-0/+14
| | | | | | | | | | | | Same as for the Clang Static Analyzer, so move the implementation into the base class and use it. This has gone unnoticed so far because it looks like that the error diagnostic from the bug report can be extracted with libclang (as shown in the info bar), but is not printed from libclang or clang.exe itself. Change-Id: I5b714ba374c5fdefe234faf012a3515e96c9a08c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Fix parsing MSVC's crtdefs.h for 64 BitNikolai Kosjar2016-10-181-0/+8
| | | | | | | | | | | | | ...by specifying the word width, as for the Clang Static Analyzer. This has gone unnoticed so far because it looks like that the error diagnostic from the bug report can be extracted with libclang (as shown in the info bar), but is not printed from libclang or clang.exe itself. Task-number: QTCREATORBUG-17130 Change-Id: Ia7a5ee3825c7211cdf80c2166a9eb454ce48cac1 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Use compiler specific undefine optionNikolai Kosjar2016-10-181-1/+6
| | | | | | | | | | | | | libclang generated: warning: /U__cpp_aggregate_nsdmi: 'linker' input unused [-Wunused-command-line-argument] warning: /U__cpp_alias_templates: 'linker' input unused [-Wunused-command-line-argument] ... It needs -U. Change-Id: Ibbd2f97e6f806215e3008803f57608b9b6b4c641 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Avoid "defineLine" in CompilerOptionsBuilder APINikolai Kosjar2016-10-171-9/+11
| | | | | | | ...because it might suggest to append a new line. Change-Id: I8d5701a1d20c9d94ee528383227a6e3b446b4ff2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Always pass in header paths as native pathsNikolai Kosjar2016-10-171-6/+2
| | | | | Change-Id: I473c737107c14a4bc2c78b7c697eef02eb4bacff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Exclude compiler option from conversion to native pathNikolai Kosjar2016-10-171-3/+4
| | | | | | | ...otherwise e.g. MSVC's "/I" option will be converted to "\I". Change-Id: Ia01519ee5c942d0f3cdd32c4302055d0e58fb865 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Fix path for intrinsics for clang toolchainsNikolai Kosjar2016-10-131-1/+10
| | | | | | | | | | | | | Ignore the include path for intrinsics coming from the toolchain. The clang static analyzer comes with its own intrinsics and does not cope well with intrinsics from other clang versions. Move the relevant implementation from LibClangOptionsBuilder into the base class so that ClangStaticAnalyzer profits from this, too. Task-number: QTCREATORBUG-17102 Change-Id: Id9a28ddebb889c862939332dce888a80b3bb7e63 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Stop passing on toolchain defines for qmake/msvc caseNikolai Kosjar2016-07-071-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-produce with: 1) Open qt-essential-includes.pro and configure it with a Qt 5.7.0 MSVC2013 64 Bit Kit. 2) Run the analyzer. Errors during analyzing occur in winnt.h [1]. This is somehow related to /D__int32=long that we pass on. Removing it helps. It looks like there is no reason anymore to pass on the toolchain defines with clang-3.8 at all. Our unit test projects can be parsed by the analyzer without them. Tested with the following kits: Qt 5.6.0 (mingw39_32) Qt 5.6.0 (msvc2013) Qt 5.6.0 (msvc2013_64) Qt 5.6.0 (msvc2015) Qt 5.6.0 (msvc2015_64) Qt 5.7.0 (mingw53_32) Qt 5.7.0 (msvc2013) Qt 5.7.0 (msvc2013_64) Qt 5.7.0 (msvc2015) Qt 5.7.0 (msvc2015_64) [1] In file included from D:\dev\creator\creator-4.1\src\plugins\clangstaticanalyzer\unit-tests\qt-essential-includes\main.cpp:2: In file included from D:/usr/qt-5.7.0-msvc2013_64/5.7/msvc2013_64/include/QtGui\QtGui:32: In file included from D:/usr/qt-5.7.0-msvc2013_64/5.7/msvc2013_64/include/QtGui/qopenglcontext.h:60: In file included from D:/usr/qt-5.7.0-msvc2013_64/5.7/msvc2013_64/include\QtGui/qopengl.h:49: In file included from D:/usr/qt-5.7.0-msvc2013_64/5.7/msvc2013_64/include\QtCore/qt_windows.h:61: In file included from C:\Program Files (x86)\Windows Kits\8.1\include\um\windows.h:164: In file included from C:\Program Files (x86)\Windows Kits\8.1\include\shared\windef.h:24: In file included from C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h:182: C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(3077,1) : error: functions that differ only in their return type cannot be overloaded __getcallerseflags ( ^ D:\dev\llvm\3.8\changingLibClang_install\bin\..\lib\clang\3.8.1\include\intrin.h(68,14) : note: previous declaration is here unsigned int __getcallerseflags(void); ~~~~~~~~ ^ 1 error generated. Change-Id: I2de8d0393a575f88dd59dfa71fbfb11f2debc158 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Pass on file paths with native separatorsNikolai Kosjar2016-07-041-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | libclang 3.8 seems to be sensitive to file paths separators [1]. On Windows, this led to not updated document annotations and/or crashes after reparsing. When passing file paths to libclang, convert to native separators. When getting file paths from libclang, convert back. This handles: * main file path * file paths of the unsaved files * -I<DIR> arguments, the resource path (for builtins) and the paths to the wrapped qt headers * included header files from libclang * source locations from libclang Also, minimize the conversion in SourceLocation to a minimum by making filePath() lazy. [1] https://llvm.org/bugs/show_bug.cgi?id=28381 Change-Id: If5866f34a6fdc6b34b16c022d3988e8e6eae2a0a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Clang: Enable exceptions explicitlyNikolai Kosjar2016-04-131-0/+6
| | | | | | | | | | | | | For some reason, clang 3.8.0 on Windows does not enable exceptions anymore, which leads to parse errors in MSVC headers (reported upstream [1]). With this change, we can finally parse main/mainwindow.cpp of a Qt Widgets Application for a MSVC2015 Kit and libclang 3.8.0 without any error. [1] https://llvm.org/bugs/show_bug.cgi?id=27324 Change-Id: I532ad4852a06318baf083d363378bc577b3c4309 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Clang: Undefine language features as fix for MSVC2015/clang-3.8.0Nikolai Kosjar2016-04-121-0/+49
| | | | | | | | | | This applies the following change for the clang code model, too. commit d13d1795241602ca0cf150b216b282cfb15e406d Clang Static Analyzer: Workaround analyzing MSVC2015 projects with clang 3.8.0 II Change-Id: Ia229d7e8b24c2e1c0a83d9a53c623ea1f79c4a06 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Clang: Set -fms-compatibility-version explicitlyNikolai Kosjar2016-04-121-7/+73
| | | | | | | | | | | | | | | Infer the version from the _MSC_FULL_VER macro, so it cannot get out of sync with that. Adapt the analyzer to do the same. Based on commit daf08d8702905335e3fc63c629f917e99715b915 Clang Static Analyzer: Workaround analyzing MSVC2015 projects with clang 3.8.0 Change-Id: I9d34abdbe2c83fe271eadd8d051caad43aca6772 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Clang: Explicitly set the target tripleNikolai Kosjar2016-04-111-0/+8
| | | | | | | | | | | As for the analyzer, this makes us independent of the default triple and will most likely reduce the maintenance - e.g. the target implies certain internal command line arguments, we will profit from added ones. This fixes parsing of mingw headers with the clang code model. Change-Id: I722b981125a80fac5f62a7af40a83ecdd7bbf811 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* CppTools: Apply has_include workaround also for a mingw toolchainNikolai Kosjar2016-03-041-2/+7
| | | | | Change-Id: Ib501b40870f71a552b0bd38fa4977b450fd37954 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update files in src/plugins Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>