summaryrefslogtreecommitdiff
path: root/src/plugins/clangstaticanalyzer
Commit message (Collapse)AuthorAgeFilesLines
* Clang: Take precompiled headers into account when parsing source filesDenis Klychkov2016-11-161-3/+14
| | | | | | Task-number: QTCREATORBUG-15590 Change-Id: Icbfce4ffd6e9f9802641d35d898fa1dc1c4c18ee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangStaticAnalyzer: Raise supported clang version to 3.9.0Nikolai Kosjar2016-11-151-2/+2
| | | | | Change-Id: Ic8eb8c7b25f1b2b6bdb6b645816342748b181bd0 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangStaticAnalyzer: Tests: Rely on projects telling when they finished parsingNikolai Kosjar2016-10-311-17/+44
| | | | | | | | | | | | | | | | | We relied on the CppModelManager to tell us whether a project was reparsed after a kit change. While this worked, it was not guaranteed that the project is really finished (and ready for e.g. building) after pushing new ProjectInfos to the CppModelManager. Rely on the projects telling when they are finished with parsing. This is more accurate and future-proof. The introduced signals in Project and SessionManager are (at the moment) only for tests. Change-Id: I1b368ec4585ffa8755eb28fac6d187cce31243ee Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Tests: Change target only if necessaryNikolai Kosjar2016-10-211-8/+10
| | | | | | | ...otherwise we wait for nothing. Change-Id: Ia55d4845f8dd0fe746ee6c8ca19b5312879294d1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang*: Workaround parsing mingw's <type_traits> with clang 3.9Nikolai Kosjar2016-10-181-0/+1
| | | | | | | | | | | | ...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-8/+1
| | | | | | | | | | | | 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-182-28/+17
| | | | | | | | | | | | | ...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-0/+7
| | | | | | | | | | | | | 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: Always pass in header paths as native pathsNikolai Kosjar2016-10-171-1/+1
| | | | | Change-Id: I473c737107c14a4bc2c78b7c697eef02eb4bacff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Remove new line character from define valueNikolai Kosjar2016-10-171-1/+1
| | | | | Change-Id: I3949ba372c490d39b4277825f5194a8d36ee26d2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Use native paths consistentlyNikolai Kosjar2016-10-132-3/+3
| | | | | | | ...when passing on arguments to the clang executable. Change-Id: I78d523289abadee85d8987e54fb962220b1e62a8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Tests: Clarify meaning of assertNikolai Kosjar2016-10-131-1/+2
| | | | | | | | | 'arguments.first().toBool()' returned FALSE ...is not very expressive. Change-Id: Ia0c8e8fbe2e84ea4f41668a5179a63e2003bab03 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Tests: Fix switching startup projectNikolai Kosjar2016-10-041-1/+3
| | | | | Change-Id: Ia29a8082a7c7764e7a426ce121c17c80b334d84d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Core: Make IOptionsPage::categoryIcon a Utils::IconAlessandro Portale2016-09-201-1/+1
| | | | | | | This is necessary for themable + HighDPI icons in the options dialog. Change-Id: I8e3ff87a24591af40bb76b39cd970443d7678fae Reviewed-by: hjk <hjk@qt.io>
* Fix merge issueEike Ziller2016-08-311-1/+1
| | | | | Change-Id: I328720587d8a973fabcbd9c66a70185ba29cbbca Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.1'Eike Ziller2016-08-315-2/+290
|\ | | | | | | | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri src/plugins/qmakeprojectmanager/makestep.cpp src/shared/qbs Change-Id: If1787ed23afa786ed2cef57f53c1db642559cbe0
| * ClangStaticAnalyzer: Simplify testing various kitsNikolai Kosjar2016-08-255-2/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The already available ClangStaticAnalyzerUnitTests uses the automatically set up "Desktop" kit to run the analyzer. This is fine for tests that are run in the build environment of Qt Creator. However, testing different kits on the same machine means to build Qt Creator itself with those kits, which is not practical. The new ClangStaticAnalyzerSessionTests will open the predefined session "ClangStaticAnalyzerPreconfiguredSession" and for each project and each target it will run the analyzer. If there is no such session, the test will be skipped. To manually preconfigure the desired session: 1. ./qtcreator -settingspath /custom/path 2. Set up the desired kits. 3. Create a session with the name ClangStaticAnalyzerPreconfiguredSession and load the desired test projects. To run the test: ./qtcreator -settingspath /custom/path -test ClangStaticAnalyzer,testPreconfiguredSession Change-Id: I0f027353854088d3acf8acecc16c74e9f0516e7d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Merge remote-tracking branch 'origin/4.1'Eike Ziller2016-08-222-4/+13
|\ \ | |/ | | | | Change-Id: I80f96f100046625f24b6ab5d13fdb05660365abc
| * ClangStaticAnalyzer: Simplify debuggingNikolai Kosjar2016-08-191-2/+10
| | | | | | | | | | | | | | | | | | | | * If the logging rules are active, add "-v" to the clang command line. This provides the internal command line and the effective include paths. * Dump output also for the success case. Change-Id: I16a01d010c68575a983a4fb82f8bd8632c2fc20c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
| * Fix that clang static analyzer did not find built-in headersEike Ziller2016-08-181-2/+3
| | | | | | | | | | | | | | | | | | Clang expects these to lie in "../lib/clang" relative to the clang executable. Change-Id: I216860876591dca1fd728e4b1e79b4b07c965620 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Remove uses of deprecated QProcess::error signalOrgad Shaneh2016-08-091-6/+3
| | | | | | | | | | | | | | | | | | This overload of error is deprecated in 5.6. Replace with errorOccurred, which was introduced in 5.6. Change-Id: Iccfba7e7103b7ce377471696f1f2ec217e52c840 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* | Simplify Utils::sort calls that sort by memberOrgad Shaneh2016-08-091-3/+1
| | | | | | | | | | Change-Id: I0937e98014f223f42fbf1c6b2bd94fb109bc8870 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | TreeModel: Introduce a TreeItem::indexInParent() convenience functionhjk2016-08-031-1/+1
| | | | | | | | | | | | | | To shorten user code and hide the ugly const_cast. Change-Id: I798bd105932004ea17cb95b243fc38ccfcda0a2c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge remote-tracking branch 'origin/4.1'Orgad Shaneh2016-07-291-3/+20
|\ \ | |/ | | | | Change-Id: Ie96fa53a88bcd06fa688a579c1d84aaf6f5e905f
| * ClangStaticAnalyzer: Do not try to determine version of clang-cl.exeNikolai Kosjar2016-07-271-3/+20
| | | | | | | | | | | | | | It does not understand "--version". Use clang.exe for the version check. Change-Id: I64a46e8e2e5be47ad6f13c9c5497264e1128a22a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Utils: Streamline TreeModel APIhjk2016-07-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The LeveledTreeModel case is general enough to cover the UniformTreeModel case, so merge them and rename to TreeModel. The former TreeModel is now BaseTreeModel. BaseTreeModels should not be instantiated directly, a tree model with non-uniform basic items is available as TreeModel<>. Done-with: Eike Ziller <eike.ziller@qt.io> Change-Id: I64a65617ab68c0cde39cf65f4bc092ef808ee6fb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | ProjectExplorer: Rework mode main windowhjk2016-07-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing solution with the special-style horizontal kit selector comes from a time when there was typically one, at most four targets. Today's setup can easily reach half a dozen targets with several toolchain versions each and can't be sensibly handled with the overflowing horizontal bar. This here replaces the horizontal kit selector bar as well as the top level project "tab bar" with a normal tree view. All targets are visible (but possibly disabled) at once, and can be enabled/disabled using the context menu on the tree items. Change-Id: I1ce7401ca96109bf34bc8c0ae19d265e5845aa88 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* | Merge remote-tracking branch 'origin/4.1'Orgad Shaneh2016-07-226-4/+156
|\ \ | |/ | | | | Change-Id: Ia90424d479936a898705c433e5810c77ae088b2c
| * ClangStaticAnalyzer: Warn about unsupported versionNikolai Kosjar2016-07-196-4/+156
| | | | | | | | | | | | Change-Id: I4d8471b7d49c8f295d37add5a0c5b8a698e0f9d4 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | Merge remote-tracking branch 'origin/4.1'Eike Ziller2016-07-152-1/+17
|\ \ | |/ | | | | Change-Id: I041b949aff8bee481a572ba6f7e2ef72b9010923
| * ClangStaticAnalyzer: Fix analyzing qbs projects on macOSNikolai Kosjar2016-07-131-0/+16
| | | | | | | | | | | | | | | | | | The system clang on macOS is aware of the header paths, but not our shipped clang. Task-number: QTCREATORBUG-15869 Change-Id: Iabb56d9443808be2822a21b48bb111a6a8a8c604 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
| * ClangStaticAnalyzer: Tests: Exclude <cstdalign> also for libc++Christian Stenger2016-07-121-1/+1
| | | | | | | | | | Change-Id: I4104d9ad2b41e0f5e8833f2ba8c94f8b9d38ca63 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Kits: Save several ToolChains per kitTobias Hunger2016-07-143-4/+5
|/ | | | | | | | | | BREAKS BACKWARD COMPATIBILITY OF TOOLCHAIN SETTINGS! * Convert old ToolChainKitInformation to new version * Store several toolchains in one kit (one per language) Change-Id: Ia59a2ad067c57971ec34ce9b2e43758344443755 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
* ClangStaticAnalyzer: Stop passing on toolchain defines for qmake/msvc caseNikolai Kosjar2016-07-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ClangStaticAnalyzer: Undefine clang version macros for MSVC KitsNikolai Kosjar2016-07-071-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes parsing of Qt 5.7.0 headers with a MSVC Kit. Re-produce with: 1) Open qt-essential-includes.pro or the *.qbs and configure it with a Qt 5.7.0 MSVC2013 Kit. 2) Run the analyzer. Errors during analyzing occur in qtypetraits.h [1] because * Q_COMPILER_UNICODE_STRINGS is defined in qcompilerdetection.h because... * Q_CC_CLANG is defined because... * __clang* is defined. Undefine the __clang* macros so the "right" compiler will be detected. [1] In file included from D:\dev\creator\creator-4.1\src\plugins\clangstaticanalyzer\unit-tests\qt-essential-includes\main.cpp:1: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include/QtCore\QtCore:4: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include/QtCore/qabstractanimation.h:43: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qobject.h:46: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qobjectdefs.h:48: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qnamespace.h:43: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qglobal.h:1139: In file included from D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qtypeinfo.h:41: D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qtypetraits.h(251,19) : error: redefinition of 'QtPrivate::is_integral<unsigned short>' template<> struct is_integral<char16_t> : true_type { }; ^~~~~~~~~~~~~~~~~~~~~ D:/usr/qt-5.7.0-msvc2013_32/5.7/msvc2013/include\QtCore/qtypetraits.h(235,19) : note: previous definition is here template<> struct is_integral<unsigned short> : true_type { }; Change-Id: I10da2a1daa6f5ea2828f7ea4bcf594050a585b61 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangStaticAnalyzer: Fix gcc 4.x build for stdc++11-includes/main.cppNikolai Kosjar2016-07-071-1/+3
| | | | | | | Apparently the header file <codecvt> is unknown to gcc/mingw < 5.x. Change-Id: Iad33fc6ffbab5a0a467c1c29db0df78896ca47b6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* TreeModel: Consolidate child()/childAt() and rowCount()/childCount()hjk2016-07-071-1/+1
| | | | | | | | We never used the possibility to overload the virtual child() and rowCount() functions, it's unlikely to be needed in future. Change-Id: I7ebdf4dfc70bb0bcadea9ef3fb88f16632a95696 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangStaticAnalyzer: Improve debug outputNikolai Kosjar2016-07-052-3/+5
| | | | | | | | * Normalize line endings from process output * Do not print extra quotes Change-Id: I39e055bed09c4fe52878d63fc443130d70be95cb Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* ClangStaticAnalyzer: Print shell quoted command lineNikolai Kosjar2016-07-051-2/+3
| | | | | | | ...by using QtcProcess::quoteArg(). Change-Id: Ic7c160d0332456e94e0d5fa1ca51320b8c1dd394 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* ClangStaticAnalyzer: Add test project with C++11 includesNikolai Kosjar2016-07-055-0/+117
| | | | | | Task-number: QTCREATORBUG-16526 Change-Id: I67bbf172dabe993697d43b7b9d804a79ebfffa9c Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* ClangStaticAnalyzer: Simplify signal connectionOrgad Shaneh2016-07-041-1/+2
| | | | | Change-Id: Ia710c47a11ca08b9e12d81555ff6288583e6ad63 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* qbs build: Introduce new module "qtc".Christian Kandeler2016-06-081-1/+1
| | | | | | | | | The qtc module gathers properties that used to live in the top-level project file. This is the first step towards making it possible to build plugins against an installed Qt Creator ("out of source build"). Change-Id: Ia1514cc9c888e80be01b308e908de48980fcbdb8 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* ClangStaticAnalyzer: Start tool directly in testhjk2016-06-011-3/+1
| | | | | | | Removes the only user of DEBUGGER_EXPORT void runAction(Core::Id actionId) Change-Id: Ia26577e07ccc8a556882d99d6dd9f9c29c3bc883 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Debugger: Dissolve AnalyzerUtils::logToIssuesPane()hjk2016-05-311-7/+10
| | | | | | | | | If the Error + popup combo is generic it should live in TaskHub. If it is not, end user code should decide when to popup. Not an intermediate level. Change-Id: I195ba8c17c5cc192ff9762ed6f45629143bcbb35 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangStaticAnalyzer: Directly construct RunControlhjk2016-05-315-16/+9
| | | | | | | | This only runs directly locally, so there's currently no need to go through the AnalyzerManager indirection. Change-Id: Ie241b362b870e8ea0be221c501420573596e34f2 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Analyzer: Move toolbar icon specification down to individual RunControlshjk2016-05-311-1/+3
| | | | | | | | Giving individual RunControls the freedom back to decide what they want, even if they currrently decide to use the same one. Change-Id: Ia2acf4b9d32d23c486339b2488611038672aba25 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Icons: Move "next/prev", "[un]locked" and "zoom" from Core to UtilsAlessandro Portale2016-05-311-3/+3
| | | | | | | | | | They are needed in the timeline view. The change in qtcreator-project.qdocconf makes sure that qdoc still finds the referenced icons. Change-Id: I812fba8e57d06d93efc00c295467c83c08cd1784 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
* Analyzer: Move supportsReRunning() down to individual runControlshjk2016-05-301-0/+1
| | | | | | | | This maintains current behavior by letting all subclasses return 'false'. This might be too pessimistic, but can be fixed on a per-tool base Change-Id: I71ac1b1e2cc98cfb1c5b76bc7c60a3240c5d1dcd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-05-272-15/+18
|\ | | | | | | Change-Id: I80bc3371c6d7cf9f2d46cbcf8e79e4761213d8aa
| * Clang: Fix accepting absolute path clang executableNikolai Kosjar2016-05-182-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 506fc40a319bc785cb6fadfb0598aa9a3d0213ae broke running the analyzer with absolute paths. If the clang executable name is provided, the ".exe" suffix is not needed since we get the absolute path with Utils::Environment::searchInPath(). However, for absolute path we need to ensure the presence of the suffix in order to point to an actually existing file. Also, compare case insensitive. Task-number: QTCREATORBUG-16234 Change-Id: I9f39386c099cc544297239eca56a95c2e7430555 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com> Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>