Commit Graph

135 Commits

Author SHA1 Message Date
Marco Bubke
f5d68398d5 Clang: Fix canceling of clang query
Every AST unit is created and queried asynchronously, like before, but
we don't wait anymore but use a timer to process new sources. So the server
will not be blocked and can process other messages like cancel.

Change-Id: If0e69466c78f628190f59fd32a03cab1c3a4d0a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-28 09:15:51 +00:00
Orgad Shaneh
2129ffc954 Clang: Fix MSVC64 warnings
size_t -> uint conversion

Change-Id: Id86168a9e2b9b7f9793cedccc41a6d15c0a8dfd4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-26 09:03:47 +00:00
Marco Bubke
537217288a Clang: Ignore CHeader
Because we don't now if a *.h file is a C or C++ header we provide both
as project file if a C and C++ file is present. But C++ is not readable
by C compiler. So we skip that files and hope there is no non referenced
C header, which is very very unlikely.

Change-Id: I5505713e759749c8a0738e11b70bb6b309412966
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-20 16:09:16 +00:00
Marco Bubke
58763aa996 Clang: Silence warnings
Change-Id: I63f8a85f0a352fc8f41835bd3ab1574255d4436b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-20 16:09:05 +00:00
Marco Bubke
a66f3e8cc0 Clang: Cancel query progress bar
Change-Id: I1b8a4ec052a548e5ed09f39c3f0d3c87b13a6bd4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-20 16:08:56 +00:00
Marco Bubke
b52f559718 Clang: Remove unused code
Change-Id: If04ec8854dd61e88c14f52d4c4fb23734407c27e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-20 16:08:53 +00:00
Marco Bubke
53dedeef70 Clang: Remove dependency on PchManager
Change-Id: I9084cb3c741b3e56e3b931383b67c0564a331352
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-16 15:31:45 +00:00
Marco Bubke
79e73ea4ee Fix spelling of unitttest_public
Change-Id: Id90dbfe30bb1f1c147299c4ac8cd210dbe7d8b82
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-03 15:35:44 +00:00
Marco Bubke
c072cdfb88 Clang: Add ClangPchManager
Compiling every header file again and again is quite time comsuming. There
are technics to improve this like preambles(a kind of automated
precompiled header) but they don't share their data between translation
units. This approach provides an automatically generated precompiled
header for every project and subproject to improve the loading time.

Change-Id: I34f5bd4db21951175920e2a9bbf6b97b1d705969
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-30 13:55:58 +00:00
Tobias Hunger
c6f90e575e Utils: Introduce a TemporaryDirectory and TemporaryFile class
Both wrap the corresponding Qt class, but make sure all temporary files
or directories are created inside a "master temporary directory".

Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:17:10 +00:00
Tim Jenssen
c191672013 Utils: Change UNIT_TEST_PUBLIC in unitttest_public
Change-Id: If60f24e3b055d543ba7864d4eb7e8287721d1012
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-09 13:20:17 +00:00
Marco Bubke
1e3f2eec8d Clang: Consolidate all ClangCompilerOptionsBuilder into one implementation
We used the same code in different but don't shared it. From a bug fixing
perspective it's actually not that smart.

Change-Id: Iaaffc883229e259ff77f95b5cf0a8f0d8b5117df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-12-15 10:18:15 +00:00
Nikolai Kosjar
56fd0daf84 Clang: Fix build
Change-Id: I279f5641f3e9a54e6d03003cd6b4e2740e54aa15
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-13 12:44:12 +00:00
Marco Bubke
3070a28422 Clang: Filter generated files
Generated files are not available, so clang will stop with an fatal error.

Change-Id: I80754015a1daf48cbf2ce8e06526c75b05b2901c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:41:01 +00:00
Marco Bubke
e8960b9bd3 Clang: Connect alive timer
You had to set the no alive timer environment variable.

Change-Id: I1994087a68d8293963f9f48fa1632f7c6822b146
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:40:55 +00:00
Marco Bubke
15de02ea0c Clang: Add refactoring support for unsaved content
We need the generated UI header but we don't have a build directory. So we
provide clang with in memory represations of the file.

Change-Id: Ie9db97bbea2222b0203a0457baa1f1fc7ad97213
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:39:11 +00:00
Marco Bubke
636eea99f4 Clang: Call the finishProcess() in ~RefactoringConnectionClient
Otherwise we call virtual function in the base class.

Change-Id: I35a3d9a59dc6558b9386ccfa7169cef5f2e15e10
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:38:56 +00:00
Marco Bubke
105a628255 Clang: Improve ClangRefactoringPlugin initializing
Change-Id: I2e45d588e7a8c50b61b401c6dea9f3cf8db45611
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:38:46 +00:00
Tim Jenssen
6fe90532dc Utils: Add offset to search results
Offset are better to compute the length of a text range. The only problem
is that we get them for utf8 because that is the text representation of
source file. QTextDocument is Utf16 based, so it can not binary represent
the source file. Actually I do not see a simple performing workaround for
it.

Change-Id: Id615e1ee6a6e85c6ecc4f8044e275142409d9b46
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:33:34 +00:00
Tim Jenssen
7f757884c5 Clang: Extend clang query
It's a first step to introduce clang query.

Change-Id: I4d001a8883f56066765ce6bc561fa3f49611c0a4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:16:04 +00:00
Orgad Shaneh
6d1d1a4416 Merge remote-tracking branch 'origin/4.2'
Change-Id: I957c22020fbacb2f631220b0cdc7fa16a782798b
2016-11-21 10:25:45 +02:00
Eike Ziller
4026864f38 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/plugins/clangrefactoring/refactoringengine.cpp
	src/tools/clangrefactoringbackend/source/symbolfinder.cpp

Change-Id: I7c1c87f3b8ade43a07f6668565501042e967fa8b
2016-11-16 16:04:59 +01:00
Denis Klychkov
36d4d01cd3 Clang: Take precompiled headers into account when parsing source files
Task-number: QTCREATORBUG-15590
Change-Id: Icbfce4ffd6e9f9802641d35d898fa1dc1c4c18ee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-16 09:10:14 +00:00
Tim Jenssen
9c7ff5199f Clang: Add clang query
Clang query is mechanism to use AST matcher to search for code. Think
about regular expression but in the context of AST. So you get a semantic
search tool for C++.

Change-Id: I72e882c5b53a0c52f352a3664847c4c3e4f6fc2e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-15 15:30:33 +00:00
Tim Jenssen
cb3064a09e Clang: use a pri file to set clang defines
Change-Id: I52167ab3ce480c795cb0f0bcd749f97b34db86d3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-11-01 14:14:40 +00:00
Nikolai Kosjar
df581265c3 Clang*: Workaround parsing mingw's <type_traits> with clang 3.9
...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>
2016-10-18 15:07:15 +00:00
Nikolai Kosjar
57ac8d96c7 Clang: Avoid running into gcc/mingw intrinsics
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>
2016-10-18 15:04:16 +00:00
Nikolai Kosjar
b0a49ca1c1 Clang: Fix parsing MSVC's crtdefs.h for 64 Bit
...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>
2016-10-18 15:03:52 +00:00
Nikolai Kosjar
6884ab080e ClangStaticAnalyzer: Fix path for intrinsics for clang toolchains
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>
2016-10-13 10:17:58 +00:00
Nikolai Kosjar
f8a404c258 Clang: Clarify process output prefix
"stderr" is clearer and it does not get in the way when searching for
diagnostics starting with "error: ".

Change-Id: I7dcd679ad65964ee66d69385550d808f6dbf91ae
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-22 09:42:29 +00:00
Marco Bubke
d4e68b7e09 Clang: Finish refactoring process explicit
Change-Id: I90b5efd8cf0492c7528ebdf14d6b5dc0b7b28536
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-21 12:26:29 +00:00
Marco Bubke
3fd6b1fa0a Clang: Initialize not static but at plug initialization
Change-Id: I856c35c81d13f31c290ef40dad5ee647ab521052
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-21 12:26:17 +00:00
Alessandro Portale
061582681c ClangRefactoring: Fix Msvc warning
clangrefactoringplugin.cpp(51): warning C4138: '*/' found outside of
comment.

Change-Id: I0cda4e07e43ece2ec24ebb130394ac007d6e7646
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-12 16:05:31 +00:00
Tobias Hunger
0af4502115 Clangbackend: Fix warnings about inconsistent use of override
Change-Id: Ic9debe482a34637f838a1badbd0ef9fcb6651258
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-08-16 10:27:53 +00:00
Marco Bubke
4cdb5bab15 Clang: Add clang refactoring
Change-Id: I2e3f36f810276da3f8dc7dcc587b06f8edb586d3
GPush-Base: d02f51b48fc752fddcdef6dcb32b3f7f6c0195a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-04 14:37:19 +00:00