Commit Graph

2589 Commits

Author SHA1 Message Date
NAKAMURA Takumi 7db18e9b66 clang-tools-extra/test/clang-tidy/performance-inefficient-vector-operation.cpp: Appease targeting msvc with -fno-ms-extensions.
FIXME: This may work with -target x86_64-win32.
llvm-svn: 300545
2017-04-18 12:13:30 +00:00
Haojian Wu c5cc03377e [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
Summary:
The "performance-inefficient-vector-operation" check finds vector oprations in
for-loop statements which may cause multiple memory reallocations.

This is the first version, only detects typical for-loop:

```
std::vector<int> v;
for (int i = 0; i < n; ++i) {
  v.push_back(i);
}

// or

for (int i = 0; i < v2.size(); ++i) {
  v.push_back(v2[i]);
}
```

We can extend it to handle more cases like for-range loop in the future.

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: zaks.anna, Eugene.Zelenko, mgorny, cfe-commits, djasper

Differential Revision: https://reviews.llvm.org/D31757

llvm-svn: 300534
2017-04-18 07:46:39 +00:00
Alexander Shaposhnikov ffb997a8eb [clang-move] Create ClangMoveActionFactory on stack
This diff removes unnecessary using of unique_ptr with ClangMoveActionFactory (pico cleanup).
NFC

Test plan: make check-clang-tools

Differential revision: https://reviews.llvm.org/D32063

llvm-svn: 300356
2017-04-14 18:12:11 +00:00
Nirav Dave 21d5d4fbbf Silence -Wlogical-op-parentheses warning NFC
llvm-svn: 300324
2017-04-14 14:36:45 +00:00
Gabor Horvath 6f0e2ac858 [clang-tidy] Fixes to misc-forwarding-reference-overload check.
* Style fixes to tests
* Make it work consistently on all platforms

Patch by András Leitereg!

llvm-svn: 300320
2017-04-14 12:31:36 +00:00
Eric Fiselier 6eee3a3fca Fix clang-tidy shared link with libc++
Currently the ClangTidyMain.cpp fails to link against shared LLVM/Clang libraries
due to the missing symbol:

  clang::tooling::operator<(clang::tooling::Replacement const&,
                            clang::tooling::Replacement const&);

This patch fixes the issue by correctly linking clangToolingCore which contains
the definition.

llvm-svn: 300115
2017-04-12 22:07:47 +00:00
Krasimir Georgiev 95ef171797 [clangd] Rename ClangDMain.cpp -> ClangdMain.cpp, NFC
llvm-svn: 300077
2017-04-12 17:13:08 +00:00
Sylvestre Ledru c94f320bd8 Add the definition of P in the clang tidy example
llvm-svn: 299961
2017-04-11 16:28:15 +00:00
Krasimir Georgiev 4714f7cba9 [clangd] Implement item kind for completion results
Summary: The patch implements the conversion method from CXCursorKind to clangd::CompletionItemKind.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D31853

llvm-svn: 299935
2017-04-11 13:27:15 +00:00
Sylvestre Ledru 09ffef2c10 Add more examples to clang tidy checkers
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D31860

llvm-svn: 299920
2017-04-11 07:10:48 +00:00
Reid Kleckner 65f015ac7f [clangd] Relax absolute path checking assertion
clangd can process absolute paths from systems that don't use the native
path style, so this assertion needs to check both Windows and Posix path
styles.

Fixes PR32596

llvm-svn: 299854
2017-04-10 17:03:44 +00:00
Reid Kleckner 08126372e3 Revert "XFAIL clangd tests on Windows"
This reverts r299849, apparently these tests only fail on my machine.

llvm-svn: 299850
2017-04-10 16:55:48 +00:00
Reid Kleckner 7e1548d6db XFAIL clangd tests on Windows
They all assert. Filed as PR32596.

llvm-svn: 299849
2017-04-10 16:50:55 +00:00
Krasimir Georgiev 5776e2f8e1 [clangd] Fix nondeterminism in clangd test
llvm-svn: 299844
2017-04-10 14:06:54 +00:00
Krasimir Georgiev 561ba5e667 [clangd] Remove ASTUnits for closed documents and cache CompilationDatabase per directory.
Contributed by ilya-biryukov!

Differential Revision: https://reviews.llvm.org/D31746

llvm-svn: 299843
2017-04-10 13:31:39 +00:00
Haojian Wu 0bc5e02799 Fix compiler warnings: "ISO c99 requires rest arguments to be used" on
the test file.

llvm-svn: 299764
2017-04-07 12:37:32 +00:00
Krasimir Georgiev 50117372db [clangd] Extract FsPath from file:// uri
Patch contributed by stanionascu!

rfc8089#appendix-E.2 specifies that paths can begin with a drive letter e.g. as file:///c:/.
In this case just consuming front file:// is not enough and the 3rd slash must be consumed to produce a valid path on windows.

The patch introduce a generic way of converting an uri to a filesystem path and back.

Differential Revision: https://reviews.llvm.org/D31401

llvm-svn: 299758
2017-04-07 11:03:26 +00:00
Alexander Kornienko 434b333afd [clang-tidy] A couple of minor fixes in modernize-use-using tests
llvm-svn: 299752
2017-04-07 09:41:27 +00:00
Chih-Hung Hsieh 90fccec5ee [clang-tidy] Reuse FileID in getLocation
One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

This requires changes in getColumnNumber, D31406, rL299681.

Differential Revision: http://reviews.llvm.org/D31406

llvm-svn: 299700
2017-04-06 20:19:26 +00:00
Gabor Horvath edaf907d36 [clang-tidy] Temporarily disable a test-case that does not work on windows.
llvm-svn: 299657
2017-04-06 15:58:57 +00:00
Alexander Kornienko 215604c252 [clang-tidy] Update docs and help message
llvm-svn: 299651
2017-04-06 14:27:00 +00:00
Alexander Kornienko 2561320f80 [clang-tidy] Add FormatStyle configuration option.
llvm-svn: 299649
2017-04-06 13:41:29 +00:00
Gabor Horvath e228f68811 Attempt to fix build bots after r299638.
llvm-svn: 299645
2017-04-06 12:49:35 +00:00
Simon Pilgrim 4e682348a2 Wdocumentation fix
llvm-svn: 299642
2017-04-06 10:49:02 +00:00
Gabor Horvath b3856d65ea [clang-tidy] Check for forwarding reference overload in constructors.
Patch by András Leitereg!

Differential Revision: https://reviews.llvm.org/D30547

llvm-svn: 299638
2017-04-06 09:56:42 +00:00
David Blaikie 0c0c8c4d38 Fix -Wmissing-field-initializer warnings to unbreak the -Werror build
llvm-svn: 299561
2017-04-05 16:50:19 +00:00
Jonas Devlieghere c45b03bddc [clangd] Link against clangSema
Fixes linking issue introduced by rL299421 when building LLVM with
shared libraries.

llvm-svn: 299461
2017-04-04 19:42:29 +00:00
Krasimir Georgiev beaff10d39 [clangd] Fix completion test to not depend on the standard library
llvm-svn: 299440
2017-04-04 15:08:42 +00:00
Krasimir Georgiev d7f1512897 [clangd] Remove private vector fields from completion test.
llvm-svn: 299426
2017-04-04 10:42:22 +00:00
Haojian Wu 43ba525357 Fix windows buildbot error.
llvm-svn: 299422
2017-04-04 09:53:55 +00:00
Krasimir Georgiev 6d2131a04c [clangd] Add code completion support
Summary: Adds code completion support to clangd.

Reviewers: bkramer, malaperle-ericsson

Reviewed By: bkramer, malaperle-ericsson

Subscribers: stanionascu, malaperle-ericsson, cfe-commits

Differential Revision: https://reviews.llvm.org/D31328

llvm-svn: 299421
2017-04-04 09:46:39 +00:00
Haojian Wu 74f823a045 [clang-rename] Support renaming qualified symbol
Summary:
The patch adds a new feature for renaming qualified symbol references.
Unlike orginal clang-rename behavior, when renaming a qualified symbol to a new
qualified symbol (e.g "A::Foo" => "B::Bar"), this new rename behavior will
consider the prefix qualifiers of the symbol, and calculate the new prefix
qualifiers.  It aims to add as few additional qualifiers as possible.

As this is an early version (only supports renaming classes), I don't change
current clang-rename interfaces at the moment, and would like to keep its
(command-line tool) behavior. So I added new interfaces for the prototype.
In the long run, these interfaces should be unified.

No functionality changes in original clang-rename command-line tool.

This patch also contains a few bug fixes of clang-rename which are discovered by
the new unittest:

* fix a potential nullptr accessment when class declaration doesn't have definition.
* add USRs of nested declartaions in "getNamedDeclFor".

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: alexfh, cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D31176

llvm-svn: 299419
2017-04-04 09:30:06 +00:00
Krystyna Gajczyk 3a42e73c3f Fixes for modernize-use-using check:
- removed unnessacary namespaces
- added option to print warning in macros
- no fix for typedef with array
- removed "void" word from functions with 0 parameters

Differential Revision: https://reviews.llvm.org/D29262

llvm-svn: 299340
2017-04-02 19:12:20 +00:00
Haojian Wu 25fdc3acf4 [clang-tidy] Correct code-block in the doc.
llvm-svn: 299190
2017-03-31 07:55:22 +00:00
Chih-Hung Hsieh b7b6c907ba [clang-tidy] Revert D31406 (Reuse FileID in getLocation)
Somehow the change failed test clang-tidy/llvm-include-order.cpp
on Windows platform.

Differential Revision: http://reviews.llvm.org/D31406

llvm-svn: 299146
2017-03-31 01:11:11 +00:00
Chih-Hung Hsieh 4c2647bc2a [clang-tidy] Reuse FileID in getLocation
One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

Differential Revision: http://reviews.llvm.org/D31406

llvm-svn: 299119
2017-03-30 22:09:17 +00:00
Simon Pilgrim 9a54098385 Spelling mistakes in comments. NFCI.
Based on corrections mentioned in patch for clang for PR27635

llvm-svn: 299074
2017-03-30 13:10:33 +00:00
Jonathan Coe 53667b8dff [clang-tidy] fix docs in hicpp checks
Fix for sphinx-doc warnings in r299068.

llvm-svn: 299071
2017-03-30 12:59:41 +00:00
Jonathan Coe 7a6bff0820 [clang-tidy] fix for linker errors in hicpp checks
Speculative fix for linker errors in r299068.

llvm-svn: 299070
2017-03-30 12:31:02 +00:00
Jonathan Coe 88232264ac [clang-tidy] add aliases for hicpp module
Summary: Add some hicpp checks that can be implmented as alises for existing clang-tidy checks:
hicpp-explicit-conversions
hicpp-function-size
hicpp-named-parameter
hicpp-invalid-access-moved
hicpp-member-init
hicpp-new-delete-operators
hicpp-noexcept-move
hicpp-special-member-functions
hicpp-undelegated-constructor
hicpp-use-equals-default
hicpp-use-equals-delete
hicpp-use-override

Reviewers: dberlin, jbcoe, aaron.ballman, alexfh

Reviewed By: aaron.ballman

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D30383

Patch By: Jonas Toth

llvm-svn: 299068
2017-03-30 11:57:54 +00:00
Krasimir Georgiev af4adfa3ad [clangd] Add support for vscode extension configuration
Summary: Adds vscode workspace level configuration options for path to clangd binary and its arguments.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

Differential Revision: https://reviews.llvm.org/D31121

llvm-svn: 298696
2017-03-24 09:29:00 +00:00
Marek Kurdej 92ecb51fae [clang-tidy] Fix treating non-space whitespaces in checks list.
Summary:
This furtherly improves r295303: [clang-tidy] Ignore spaces between globs in the Checks option.
Trims all whitespaces and not only spaces and correctly computes the offset of the checks list (taking the size before trimming).

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D30567

llvm-svn: 298621
2017-03-23 16:32:06 +00:00
Alexander Kornienko eaada5c91e [clang-tidy] Don't use groups in the big regexy filter
Fixes https://bugs.llvm.org/show_bug.cgi?id=27641.

llvm-svn: 298619
2017-03-23 16:29:39 +00:00
Alexander Kornienko 5816a8bbb1 [clang-tidy] Fix diag message for catch-by-value
Summary:
```
catch (std::exception ex)
{
}
```

Was flagged with "catch handler catches a pointer value".

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits, JDevlieghere

Patch by Florian Gross!

Differential Revision: https://reviews.llvm.org/D30592

llvm-svn: 298608
2017-03-23 15:17:44 +00:00
Alexander Kornienko c3acd2e9c0 [clang-tidy] Catch trivially true statements like a != 1 || a != 3
Catch trivially true statements of the form a != 1 || a != 3. Statements like
these are likely errors. They are particularly easy to miss when handling enums:

enum State {
RUNNING,
STOPPED,
STARTING,
ENDING
}

...
if (state != RUNNING || state != STARTING)
...

Patch by Blaise Watson!

Differential revision: https://reviews.llvm.org/D29858

llvm-svn: 298607
2017-03-23 15:13:54 +00:00
Alexander Kornienko 33ec2d6cb1 [clang-tidy] Tests should not rely on STL headers being available.
llvm-svn: 298501
2017-03-22 12:50:10 +00:00
Alexander Kornienko 1c657f74e2 [clang-tidy] clang-format the last patch. NFC
llvm-svn: 298500
2017-03-22 12:50:05 +00:00
Alexander Kornienko ee9247ed13 [clang-tidy] modified identifier naming case to use CT_AnyCase for ignoring case style
Summary:
Using CaseType::CT_AnyCase for selected identifier results in inheriting case style setting from more basic identifier type.

This patch changes CT_AnyCase behavior to ignore case style of specified identifier. If case style was not set, llvm::Optional will be used for keeping this information (llvm::Optional<>::hasVal), thus CT_AnyCase will no longer mean more general identifier style should be used.

This eliminates false-positives when naming convention is not clear for specific areas of code (legacy, third party) or for selected types.

Reviewers: berenm, alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D30931

llvm-svn: 298499
2017-03-22 12:49:58 +00:00
Aaron Ballman 73f283e6fc Reverting r298421 due to using a header that's unavailable to all systems and some other post-commit review feedback.
llvm-svn: 298470
2017-03-22 01:08:54 +00:00
Benjamin Kramer a079cdbeb8 Apply clang-tidy's performance-unnecessary-value-param to clang-tidy.
No functionality change intended.

llvm-svn: 298442
2017-03-21 21:34:58 +00:00
Chandler Carruth 08781dc3b6 Don't make unqualified calls to functions that could well be found via
ADL as reasonable extension points.

All of this would be cleaner if this code followed the more usual LLVM
convention of not having deeply nested namespaces inside of .cpp files
and instead having a `using namespace ...;` at the top. Then the static
function would be in the global namespace and easily referred to as
`::join`. Instead we have to write a fairly contrived qualified name.
I figure the authors can clean this up with a less ambiguous name, using
the newly provided LLVM `join` function, or any other solution, but this
at least fixes the build.

llvm-svn: 298434
2017-03-21 20:15:42 +00:00
Aaron Ballman 163e7166d7 Prevent cppcoreguidelines-pro-bounds-array-to-pointer-decay from diagnosing array to pointer decay stemming from system macros.
Patch by Breno Rodrigues Guimaraes.

llvm-svn: 298421
2017-03-21 19:01:17 +00:00
Eric Liu 8bc2416414 [change-namespace] avoid adding leading '::' when possible.
Summary:
When changing namespaces, the tool adds leading "::" to references that need to
be fully-qualified, which would affect readability.

We avoid adding "::" when the symbol name does not conflict with the new
namespace name. For example, a symbol name "na::nb::X" conflicts with "ns::na"
since it would be resolved to "ns::na::nb::X" in the new namespace.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30493

llvm-svn: 298363
2017-03-21 12:41:59 +00:00
Alexander Kornienko f6cd367874 [clang-tidy] readability-container-size-empty fix for (*x).size()
llvm-svn: 298316
2017-03-20 22:15:27 +00:00
Alexander Kornienko 9bf7037ccd [clang-tidy] Small cleanup. NFC.
llvm-svn: 298315
2017-03-20 22:15:19 +00:00
Aaron Ballman dbdbabf205 Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA.
This commit renames all of the safety functionality to be hicpp, adds an appropriate LICENSE.TXT, and updates the documentation accordingly.

llvm-svn: 298229
2017-03-19 17:23:23 +00:00
Alexander Kornienko b10daaf198 [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted declarations
Summary:
There is no need for triggering warning when noexcept specifier in move constructor or move-assignment operator is neither evaluated nor uninstantiated.

This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JonasToth, JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Patch by Marek Jenda!

Differential Revision: https://reviews.llvm.org/D31049

llvm-svn: 298101
2017-03-17 16:40:34 +00:00
Eric Liu 284b97c6bc [change-namespace] do not rename specialized template parameters.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31076

llvm-svn: 298090
2017-03-17 14:05:39 +00:00
Alexander Kornienko 70c8d291c2 [clang-tidy] Added a test with a different format.
llvm-svn: 298060
2017-03-17 10:05:49 +00:00
Alexander Kornienko bc8d14669d [clang-tidy] readability-misleading-indentation: fix chained if
Summary:
Fixed erroneously flagging of chained if statements when styled like this:

```
if (cond) {
}
else if (cond) {
}
else {
}
```

Reviewers: xazax.hun, alexfh

Reviewed By: xazax.hun, alexfh

Subscribers: JDevlieghere, cfe-commits

Patch by Florian Gross!

Differential Revision: https://reviews.llvm.org/D30841

llvm-svn: 298059
2017-03-17 09:58:30 +00:00
Alexander Kornienko c7c9b75804 [clang-tidy] Verify some conditions in a matcher instead of check(). NFC
llvm-svn: 298057
2017-03-17 09:47:05 +00:00
Alexander Kornienko 7bcf7516df [clang-tidy] Ignore deleted members in google-explicit-constructor.
This fixes http://llvm.org/PR32221.

llvm-svn: 298052
2017-03-17 08:40:07 +00:00
Michal Gorny 6e31072e21 [test] Fix test dependencies when using installed tools
Use the LLVM_UTILS_PROVIDED variable to determine whether test tool
dependencies should be exposed for clang-tools-extra tests. If clang is
being built stand-alone and LLVM test tools (FileCheck, count and not)
are installed, the top-level CMakeLists.txt of clang sets this variable
to indicate that they will not be built as a part of this build,
and therefore no dependencies should be emitted for them. This fixes
the dependency errors when building clang stand-alone with tests
enabled.

Differential Revision: https://reviews.llvm.org/D29851

llvm-svn: 297806
2017-03-15 05:55:43 +00:00
Benjamin Kramer 5957a19630 [clangd] Fix not being able to attach a debugger on macOS
Clangd is often waiting for input on getline as it awaits requests. If the
getline is interrupted, it causes the system call (read) to fail and the EINTR
error to be set. This can be seen when attaching a debugger such as LLDB on
macOS. On macOS (and possibly other operating systems), this system call is not
restarted after interruption but on Linux it is restarted which is why
attaching a debugger does work correctly there.

The solution is to work around the non-restarting system call by checking the
errno for EINTR when the stream fails and try again. This should be safe on all
Unixish platforms.

See also http://bugs.llvm.org/show_bug.cgi?id=32149 for some background
discussion.

Patch by Marc-Andre Laperle!
Differential Revision: https://reviews.llvm.org/D30675

llvm-svn: 297779
2017-03-14 20:41:28 +00:00
Aaron Ballman 9dd8caad1f Add the 'AllowSoleDefaultDtor' and 'AllowMissingMoveFunctions' options to the cppcoreguidelines-special-member-functions check.
Patch by Florian Gross.

llvm-svn: 297671
2017-03-13 21:39:00 +00:00
Sam McCall 9c5ebf7039 [include-fixer] Add fuzzy SymbolIndex, where identifier needn't match exactly.
Summary:
Add fuzzy SymbolIndex, where identifier needn't match exactly.

The purpose for this is global autocomplete in clangd. The query will be a
partial identifier up to the cursor, and the results will be suggestions.

It's in include-fixer because:

  - it handles SymbolInfos, actually SymbolIndex is exactly the right interface
  - it's a good harness for lit testing the fuzzy YAML index
  - (Laziness: we can't unit test clangd until reorganizing with a tool/ dir)

Other questionable choices:

  - FuzzySymbolIndex, which just refines the contract of SymbolIndex. This is
    an interface to allow extension to large monorepos (*cough*)
  - an always-true safety check that Identifier == Name is removed from
    SymbolIndexManager, as it's not true for fuzzy matching
  - exposing -db=fuzzyYaml from include-fixer is not a very useful feature, and
    a non-orthogonal ui (fuzziness vs data source). -db=fixed is similar though.

Reviewers: bkramer

Subscribers: cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30720

llvm-svn: 297630
2017-03-13 15:55:59 +00:00
Haojian Wu b7da0eb50e [clang-rename] Introduce an unittest skeleton for clang-rename.
Summary: This will make references rename tests easier.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits, alexfh, mgorny

Differential Revision: https://reviews.llvm.org/D30813

llvm-svn: 297450
2017-03-10 10:30:14 +00:00
Sam McCall 573050e703 [include-fixer] Remove line number from Symbol identity
Summary:
Remove line number from Symbol identity.

For our purposes (include-fixer and clangd autocomplete), function overloads
within the same header should mostly be treated as a single combined symbol.

We may want to track individual occurrences (line number, full type info)
and aggregate this during mapreduce, but that's not done here.

Reviewers: hokein, bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30685

llvm-svn: 297371
2017-03-09 10:47:44 +00:00
Haojian Wu 8247fefead [clang-tidy] Update the doc according to r297311.
llvm-svn: 297367
2017-03-09 09:15:16 +00:00
Alexander Kornienko 5d698cf9a0 [clang-tidy] readability-function-size: remove default param count threshold
llvm-svn: 297311
2017-03-08 22:19:55 +00:00
Martin Bohme 96d29e5761 [clang-tidy] misc-use-after-move: Fix failing assertion
Summary:
I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.

This patch also fixes nondeterministic behavior in the source code
location reported for the move when the move is constained in an init list;
this was causing buildbot failures in the previous attempt to submit
this patch (see D30569 and rL297004).

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D30650

llvm-svn: 297272
2017-03-08 12:34:51 +00:00
Haojian Wu d7b45bc76d Do not display highlights for clang-include-fixer-at-point
Summary: When invoking clang-include-fixer-at-point, the QuerySymbolInfos point to offset 0, length 0. Rather than showing a hidden overlay, do not show any overlay at all for zero-length symbols.

Patch by Torsten Marek!

Reviewers: hokein, klimek

Reviewed By: hokein

Differential Revision: https://reviews.llvm.org/D30577

llvm-svn: 297010
2017-03-06 14:49:26 +00:00
Haojian Wu 1aa5885f00 [clang-tidy] Ignore substituted template types in modernize-use-nullptr check.
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: xazax.hun, malcolm.parsons, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D30639

llvm-svn: 297009
2017-03-06 14:46:44 +00:00
Martin Bohme 2e5f130bf4 Revert "[clang-tidy] misc-use-after-move: Fix failing assertion"
This reverts commit r297004; it was causing buildbots to fail.

llvm-svn: 297006
2017-03-06 09:46:27 +00:00
Martin Bohme a6391ae52b [clang-tidy] misc-use-after-move: Fix failing assertion
Summary:
I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D30569

llvm-svn: 297004
2017-03-06 08:55:42 +00:00
Sylvestre Ledru 5038d5c3c5 Replaced UserNullMacros with NullMacros in modernize-use-nullptr check docs
By patch Peter Goldsborough on https://github.com/llvm-mirror/clang-tools-extra/pull/14
See 2cd835ee5b/clang-tidy/modernize/UseNullptrCheck.cpp (L466)

llvm-svn: 296970
2017-03-04 14:06:26 +00:00
Piotr Padlewski b6e1aa58fd [clang-tidy] Yet another docs fixes
llvm-svn: 296888
2017-03-03 17:16:11 +00:00
Piotr Padlewski 26e176e558 [clang-tidy] Fix modernize-use-emplace docs
llvm-svn: 296867
2017-03-03 12:42:22 +00:00
Alexander Kornienko 17a4b2344e [clang-tidy] Format code around applied fixes
Summary:
Add -format option (disabled by default for now) to trigger formatting
of replacements.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kimgr, malcolm.parsons, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D30564

llvm-svn: 296864
2017-03-03 11:16:34 +00:00
Alexander Kornienko db04cccb87 [clang-tidy] google-readability-casting: don't use constructor call syntax for const types
llvm-svn: 296858
2017-03-03 08:18:49 +00:00
Alexander Kornienko b7f6fe4658 [clang-tidy] google-readability-casting: detect redundant casts with top-level const
llvm-svn: 296755
2017-03-02 15:47:28 +00:00
Alexander Kornienko ce482d9269 [clang-tidy] Fix a few more issues in google-readability-casting
* suggest static_cast instead of reinterpret_cast for casts from void*
* top-level const doesn't need a const_cast
* don't emit a separate "possibly redundant cast" warning, instead suggest
  static_cast (in C++ only) and add a little hint to consider removing the cast

llvm-svn: 296753
2017-03-02 15:27:34 +00:00
Benjamin Kramer 4c18c3743f [clangd] Fix a potential race by copying the FixIts out of ASTManager before releasing the lock.
Also document the locking semantics a bit better.

llvm-svn: 296737
2017-03-02 10:25:00 +00:00
Alexander Kornienko d993e76a18 [clang-tidy] Function names configurable for cppcoreguidelines-nomalloc - checker
Summary:
Hello everybody,

this is an incremental patch for the NoMalloc-Checker I wrote. It allows to configure the memory-management functions, that are checked,
This might be helpful for a code base with custom functions in use, or non-standard functionality, like posix_memalign.

Reviewers: aaron.ballman, hokein, alexfh

Reviewed By: aaron.ballman, alexfh

Subscribers: sbenza, nemanjai, JDevlieghere

Tags: #clang-tools-extra

Patch by Jonas Toth!

Differential Revision: https://reviews.llvm.org/D28239

llvm-svn: 296734
2017-03-02 08:28:55 +00:00
Benjamin Kramer 570c230357 [clangd] Unbreak the shared build.
llvm-svn: 296637
2017-03-01 16:23:40 +00:00
Benjamin Kramer f0af3e6b01 [clangd] Add support for FixIts.
Summary:
This uses CodeActions to show 'apply fix' actions when code actions are
requested for a location. The actions themselves make use of a
clangd.applyFix command which has to be implemented on the editor side. I
included an implementation for vscode.

This also adds a -run-synchronously flag which runs everything on the main
thread. This is useful for testing.

Reviewers: krasimir

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30498

llvm-svn: 296636
2017-03-01 16:16:29 +00:00
Alexander Kornienko 36267277d7 [clang-tidy] Attempt to fix the test where exceptions are disabled by default.
llvm-svn: 296627
2017-03-01 14:41:11 +00:00
Krasimir Georgiev 90573e49c9 [clangd] Add a toy VS Code integration for development purposes
Summary: This patch adds bare-bone VS Code integration for development purposes of clangd.

Reviewers: klimek, bkramer, mprobst

Reviewed By: bkramer

Subscribers: mprobst

Differential Revision: https://reviews.llvm.org/D30102

llvm-svn: 296618
2017-03-01 13:53:12 +00:00
Eric Liu 413671507f [change-namespace] get insertion points of forward declarations correct.
Summary:
Previously, the insertion points would conflict with the old namespace
deletion.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30490

llvm-svn: 296604
2017-03-01 10:29:39 +00:00
Alexander Kornienko 9108644dbf [clang-tidy] Add parametercount for readibility-function-size
Summary:
Add an option to function-size to warn about high parameter counts.

This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well.

Reviewers: sbenza, alexfh, hokein

Reviewed By: alexfh, hokein

Subscribers: JDevlieghere

Patch by Jonas Toth!

Differential Revision: https://reviews.llvm.org/D29561

llvm-svn: 296599
2017-03-01 10:17:32 +00:00
Alexander Kornienko eedf7ec07f [clang-tidy] Fix handling of methods with try-statement as a body in modernize-use-override
Summary:
Fix generated by modernize-use-override caused syntax error when method
used try-statement as a body. `override` keyword was inserted after last
declaration token which happened to be a `try` keyword.

This fixes PR27119.

Reviewers: ehsan, djasper, alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Patch by Paweł Żukowski!

Differential Revision: https://reviews.llvm.org/D30002

llvm-svn: 296598
2017-03-01 10:16:36 +00:00
Haojian Wu b780c59b93 [clang-tidy] Fix a false positive on modernize-use-nullptr check.
Summary:
The false positive happens on two neighbour CXXDefaultArgExpr AST nodes.
like below:

```
CXXFunctionalCastExpr 0x85c9670 <col:7, col:23> 'struct ZZ' functional cast to struct ZZ <ConstructorConversion>
 `-CXXConstructExpr 0x85c9518 <col:7, col:23> 'struct ZZ' 'void (uint64, const uint64 *)'
   |-CallExpr 0x85a0a90 <col:10, col:22> 'uint64':'unsigned long long'
   | |-ImplicitCastExpr 0x85a0a78 <col:10> 'uint64 (*)(uint64)' <FunctionToPointerDecay>
   | | `-DeclRefExpr 0x85a09f0 <col:10> 'uint64 (uint64)' lvalue Function 0x85a06a0 'Hash' 'uint64 (uint64)'
   | `-CXXDefaultArgExpr 0x85a0ac8 <<invalid sloc>> 'uint64':'unsigned long long'
   `-CXXDefaultArgExpr 0x85c94f8 <<invalid sloc>> 'const uint64 *'
```

For each particular CXXDefaultArgExpr node, we need to reset
FirstSubExpr, otherwise FirstSubExpr will refer to an incorrect expr.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D30412

llvm-svn: 296479
2017-02-28 15:29:52 +00:00
Alexander Kornienko 6414ab726d Misspelled checker description (argument comment)
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: Eugene.Zelenko

Tags: #clang-tools-extra

Patch by Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D24137

llvm-svn: 296472
2017-02-28 14:13:26 +00:00
Haojian Wu d09ed40e95 [find-all-symbols] Implement operator== for SymbolAndSignals and SymbolInfo::Signals.
llvm-svn: 296461
2017-02-28 10:13:26 +00:00
Eric Liu 3a7e13140a [change-namespace] trying to fix windows buildbot failure.
llvm-svn: 296458
2017-02-28 10:00:15 +00:00
Sam McCall b27dc2245f [include-fixer] Add usage count to find-all-symbols.
Summary:
Add usage count to find-all-symbols.

FindAllSymbols now finds (most!) main-file usages of the discovered symbols.
The per-TU map output has NumUses=0 or 1 (only one use per file is counted).
The reducer aggregates these to find the number of files that use a symbol.

The NumOccurrences is now set to 1 in the mapper rather than being inferred by
the reducer, for consistency.

The idea here is to use NumUses for ranking: intuitively number of files that
use a symbol is more meaningful than number of files that include the header.

Reviewers: hokein, bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30210

llvm-svn: 296446
2017-02-28 08:13:15 +00:00
Benjamin Kramer f2524e6599 [clangd] Make clangd install to bin
This allows the install target to also install clangd to bin, so that
it can be deployed and used outside the build tree.

Patch by Marc-Andre Laperle!
Differential Revision: https://reviews.llvm.org/D30425

llvm-svn: 296390
2017-02-27 21:40:35 +00:00
Haojian Wu 4a92050ce2 [clang-move] Extend clang-move to support moving global variable.
Summary: Also support dumping global variables.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30337

llvm-svn: 296337
2017-02-27 13:19:13 +00:00
Eric Liu 4c8767fa55 [change-namespace] fix asan failure in r296110.
llvm-svn: 296113
2017-02-24 12:56:51 +00:00
Eric Liu 7fccc9995a [change-namepsace] make it possible to whitelist symbols so they don't get updated.
Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30328

llvm-svn: 296110
2017-02-24 11:54:45 +00:00
Daniel Marjamaki 80c3b17410 [clang-tidy] Fix readability-redundant-declaration false positive
Differential Revision: https://reviews.llvm.org/D27048

llvm-svn: 296100
2017-02-24 09:02:44 +00:00
Manuel Klimek c38cd69256 Make clang-include-fixer--insert-line work when the difference is on an empty line
`clang-include-fixer--insert-line` has an off-by-one error because it
uses `(goto-char (point-min)) (forward-char chars)`, which is (goto-char
(1+ chars))`. Because of this, when the first difference was on an empty
line (i.e. an include was appended to the block of includes), the
pointer in the `to` buffer would be on the next line.

Also wrapped calls inside another process sentinel inside `with-local-quit`.

Patch by Torsten Marek.

Differential Revision: https://reviews.llvm.org/D30292

llvm-svn: 295988
2017-02-23 16:02:53 +00:00
Manuel Klimek 0042499f48 Completion related fixes for clang-include-fixer.el.
1. Quitting inside a process sentinel is not allowed, but the sentinel invokes
completion, where the user is free to hit C-g. By wrapping the call in
with-local-quit, the process sentinel invocation can finish without triggering
an error
2. Invoke completing-read instead of ido-completing-read, since this may
interfere with user customizations to completing-read-function. The user should
use something like ido-ubiquitous if ido completion is wanted
3. Compare the string returned from completion with string=, since it may be a
copy of the original string in the collection

Patch by Torsten Marek.

llvm-svn: 295818
2017-02-22 09:21:22 +00:00
Manuel Klimek cb2358991b Adds a hook clang-include-fixer-add-include-hook that is invoked with the path and type of the added include.
This patch also adds a new function clang-include-fixer-from-symbol, which prompts the user for a symbol to resolve and include.

Patch by Torsten Marek.

llvm-svn: 295814
2017-02-22 08:26:04 +00:00
Benjamin Kramer ba5df6dea5 [clang-tidy] Reword the "code outside header guard" warning.
The check doesn't really know if the code it is warning about came before
or after the header guard, so phrase it more neutral instead of complaining
about code before the header guard. The location for the warning is still
not optimal, but I don't think fixing that is worth the effort, the
preprocessor doesn't give us a better location.

Differential Revision: https://reviews.llvm.org/D30191

llvm-svn: 295715
2017-02-21 11:25:45 +00:00
NAKAMURA Takumi 8b33514617 clangd/ASTManager.cpp: Appease msc19 Debug build -- Don't deref std::vector::end().
llvm-svn: 295600
2017-02-19 07:18:16 +00:00
Alexander Kornienko 93748ebf82 [clang-tidy] google-readability-casting: Handle user-defined conversions
llvm-svn: 295544
2017-02-18 09:45:00 +00:00
Simon Pilgrim 356bb00b7e Fix windows buildbots that don't have full shell support
llvm-svn: 295498
2017-02-17 21:31:31 +00:00
Ehsan Akhgari fae3ac3e9b [clang-tidy] Add -path option to clang-tidy-diff.py
Summary:
This flag allows specifying a custom path for the compilation
database.  Unfortunately we can't use the -p flag like other
clang-tidy tools because it's already taken.

Reviewers: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29806

llvm-svn: 295482
2017-02-17 19:31:43 +00:00
Alex Lorenz 521d222330 [Docs] 'Limitations' should be a subsection
The 'Limitations' section in thedocumentation for
readability-misleading-indentation should be a subsection, as otherwise the link
to 'Limitations' isn't indented in the 'Clang-Tidy Checks' documentation page.

llvm-svn: 295471
2017-02-17 18:11:08 +00:00
Gabor Horvath e2fa53030e [clang-tidy] Add cert-dcl58-cpp (do not modify the 'std' namespace) check.
Differential Revision: https://reviews.llvm.org/D23421

llvm-svn: 295435
2017-02-17 08:52:51 +00:00
Krasimir Georgiev 8fcdd5ab96 Fix clang-move test after clang-format update r295312
llvm-svn: 295317
2017-02-16 13:17:38 +00:00
Krasimir Georgiev f7de84ab9f [clangd] Fix Output.log error
llvm-svn: 295305
2017-02-16 10:53:27 +00:00
Krasimir Georgiev 1b8bfd4b76 [clangd] Implement format on type
Summary:
This patch adds onTypeFormatting to clangd.

The trigger character is '}' and it works by scanning for the matching '{' and formatting the range in-between.

There are problems with ';' as a trigger character, the cursor position is before the `|`:
```
int main() {
  int i;|
}
```
becomes:
```
int main() {  int i;| }
```
which is not likely what the user intended.

Also formatting at semicolon in a non-properly closed scope puts the following tokens in the same unwrapped line, which doesn't reformat nicely.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29990

llvm-svn: 295304
2017-02-16 10:49:46 +00:00
Alexander Kornienko 762adef1a9 [clang-tidy] Ignore spaces between globs in the Checks option.
llvm-svn: 295303
2017-02-16 10:23:18 +00:00
Jonas Devlieghere f9e7b3caba [clang-tidy] Fix test modernize-return-braced-init-list
llvm-svn: 295207
2017-02-15 17:37:58 +00:00
Jonas Devlieghere 0a6913bc2f Fixed indentation issue in release notes
llvm-svn: 295205
2017-02-15 17:19:44 +00:00
Jonas Devlieghere 2789043178 [clang-tidy] Add check 'modernize-return-braced-init-list'
Summary:
Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
return type and the return statement.

```
Foo bar() {
  Baz baz;
  return Foo(baz);
}

// transforms to:

Foo bar() {
  Baz baz;
  return {baz};
}
```

Reviewers: hokein, Prazek, aaron.ballman, alexfh

Reviewed By: Prazek, aaron.ballman, alexfh

Subscribers: malcolm.parsons, mgorny, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D28768

llvm-svn: 295199
2017-02-15 17:06:06 +00:00
Benjamin Kramer 0ac6d124cf [clangd] Fix another use after free that I missed because COW strings.
llvm-svn: 295198
2017-02-15 17:04:57 +00:00
Benjamin Kramer fbe32f59c2 [clangd] Silence GCC warning about falling off a fully covered switch.
llvm-svn: 295196
2017-02-15 16:58:44 +00:00
Benjamin Kramer e14bd4246d [clangd] Synchronize logs access.
I don't think that this is necessary for correctness, but makes tsan
much more useful.

llvm-svn: 295194
2017-02-15 16:44:11 +00:00
Benjamin Kramer 3858b7d6e9 [clangd] Initialize the thread after the mutex.
Otherwise locking the mutex yields a racy assertion failure on picky
implementations.

llvm-svn: 295193
2017-02-15 16:34:58 +00:00
Malcolm Parsons a3bc480455 [clang-tidy] Don't delay parsing of templates in test for misc-unconventional-assign-operator
llvm-svn: 295192
2017-02-15 16:32:55 +00:00
Benjamin Kramer 4eaf89f2d9 [clangd] Fix use after free.
llvm-svn: 295187
2017-02-15 15:56:14 +00:00
Benjamin Kramer 22abde7860 [clangd] Add missing include.
llvm-svn: 295184
2017-02-15 15:19:13 +00:00
Benjamin Kramer 4486a6c4c7 [clangd] Wire up ASTUnit and publish diagnostics with it.
Summary:
This requires an accessible compilation database. The parsing is done
asynchronously on a separate thread.

Reviewers: klimek, krasimir

Subscribers: cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29886

llvm-svn: 295180
2017-02-15 15:04:20 +00:00
Haojian Wu ead59eeade [clang-tidy] Ignore instantiated functions and static data members of classes in misc-definitions-in-headers.
Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29957

llvm-svn: 295178
2017-02-15 14:10:50 +00:00
Malcolm Parsons 51642f9d0a [clang-tidy] Don't warn about call to unresolved operator*
Summary:
The misc-unconventional-assign-operator check had a false positive
warning when the 'operator*' in 'return *this' was unresolved.

Change matcher to allow calls to unresolved operator.

Fixes PR31531.

Reviewers: alexfh, aaron.ballman

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29393

llvm-svn: 295176
2017-02-15 14:01:41 +00:00
Benjamin Kramer d1013b44e3 [clang-tidy] Add support for NOLINTNEXTLINE.
Reviewers: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29899

llvm-svn: 295049
2017-02-14 12:47:56 +00:00
Haojian Wu be2588fa7f [clang-tidy] Improve diagnostic message for misc-definitions-in-header.
Summary:
Users might get confused easily when they see the check's message on
full template function speciliations.

Add a note to the output message, which mentions these kind of function
specializations are treated as regular functions.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29928

llvm-svn: 295048
2017-02-14 12:39:22 +00:00
Gabor Horvath e647bd59f6 [clang-tidy] Add readability-misleading-indentation check.
Differential Revision: https://reviews.llvm.org/D19586

llvm-svn: 295041
2017-02-14 10:03:27 +00:00
Benjamin Kramer 19f2403d3b [clang-tidy] Reduce indentation. NFC.
llvm-svn: 294974
2017-02-13 18:03:10 +00:00
Eric Liu a13c419a29 [change-namespace] add an option to dump changed files in YAML.
Reviewers: hokein

Reviewed By: hokein

Subscribers: fhahn, cfe-commits

Differential Revision: https://reviews.llvm.org/D29893

llvm-svn: 294969
2017-02-13 17:24:14 +00:00
Mads Ravn 183e9644b9 [clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members
Fix for commit r294912 which had a small error in the AST matcher.

llvm-svn: 294913
2017-02-12 20:35:42 +00:00
Mads Ravn 6ff978fd54 [clang-tidy] Fix for bug 31838: readability-delete-null-pointer does not work for class members
I have made a small fix for readability-delete-null-pointer check so it also checks for class members.

Example of case that it fixes
```
  struct A {
    void foo() {
      if(mp)
        delete mp;
    }
    int *mp;
  };
```

Reviewers: JDevlieghere, aaron.ballman, alexfh, malcolm.parsons

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29726

llvm-svn: 294912
2017-02-12 20:09:59 +00:00
David Blaikie a67cf0001f Fix memory leak by using unique_ptr
llvm-svn: 294823
2017-02-11 05:25:21 +00:00
Benjamin Kramer e15fe37506 [clangd] Move isDone from the JSONOutput to ShutdownHandler.
This is just as easy to check from main but prevents random code from
shutting down the server.

llvm-svn: 294760
2017-02-10 17:25:38 +00:00
Alexander Kornienko 01496fe455 [clang-tidy] Fix handling of function types in google-readability-casting
llvm-svn: 294751
2017-02-10 14:57:19 +00:00
Benjamin Kramer d0b2ccd219 [clangd] Refactor stream output into a single thread-safe output object.
This abstracts away the passing of raw_ostreams everywhere, thread
safety will be used soon.

llvm-svn: 294747
2017-02-10 14:08:40 +00:00
Eric Fiselier 87c87f4c30 [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
David L. Jones dc54df9ca2 Adds the commandline need to run clang-tidy tests.
Patch by Jorge Gorbe (lethalantidote)

Differential Revision: https://reviews.llvm.org/D29737

llvm-svn: 294689
2017-02-10 01:48:43 +00:00
Hans Wennborg f4166bf0ee Don't try to link to the 4.0 release notes
llvm-svn: 294657
2017-02-09 23:25:52 +00:00
Ehsan Akhgari b7418d3b4a [clang-tidy] Add -quiet option to suppress extra output
Summary:
This new flag instructs clang-tidy to not output anything
except for errors and warnings.  This makes it easier to
script clang-tidy to run as part of external build systems.

Reviewers: bkramer, alexfh, klimek

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29661

llvm-svn: 294607
2017-02-09 18:32:02 +00:00
Alexander Kornienko 28239b166f [clang-tidy] Fix misc-unused-using-decls false positives in presence of compile errors
llvm-svn: 294578
2017-02-09 10:41:27 +00:00
Ehsan Akhgari 3bceebb0e0 [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh, klimek, bkramer

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29699

llvm-svn: 294491
2017-02-08 17:50:24 +00:00
Alexander Kornienko 385c2a3134 [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()
hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about
errors that lead to invalid AST.

llvm-svn: 294467
2017-02-08 16:11:22 +00:00
Alexander Kornienko bb64200e16 [clang-tidy] Supresses misc-move-constructor-init warning for const fields.
Patch by CJ DiMeglio!

Differential revision: https://reviews.llvm.org/D28973

llvm-svn: 294459
2017-02-08 14:56:16 +00:00
Benjamin Kramer f86708dbf5 [clangd] Strip file:// from the URI when calling formatting.
It confuses FileManager on windows.

llvm-svn: 294314
2017-02-07 16:10:17 +00:00
Benjamin Kramer d115a574b5 [clangd] Ignore comments in clangd input, so we can write tests without sed.
Another attempt on making this work on windows.

llvm-svn: 294312
2017-02-07 15:37:17 +00:00
Benjamin Kramer 81f91c1777 [clangd] Fix subtle use after return.
I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.

llvm-svn: 294309
2017-02-07 14:35:09 +00:00
Simon Pilgrim 24f1d340b3 Disable test on windows buildbots without shell support
llvm-svn: 294299
2017-02-07 13:08:22 +00:00
Benjamin Kramer 6a3d74eb50 [clangd] Set stdin to binary to fix tests on windows.
llvm-svn: 294297
2017-02-07 12:40:59 +00:00
Benjamin Kramer d588b0f525 [clangd] Harden test against sed implementations that strip \r.
Also clean up logging and don't print \0.

llvm-svn: 294294
2017-02-07 11:49:03 +00:00
Alexander Kornienko 258d9a528e [clang-tidy] misc-argument-comment - extended gmock support
It looks like direct calls to mocked methods happen in the wild. This patch
add support for these as well.

llvm-svn: 294293
2017-02-07 11:39:56 +00:00
Benjamin Kramer 59542bb08a [clangd] Add missing include.
llvm-svn: 294292
2017-02-07 10:47:40 +00:00
Benjamin Kramer bb1cdb63e5 Add a prototype for clangd
clangd is a language server protocol implementation based on clang. It's
supposed to provide editor integration while not suffering from the
confined ABI of libclang.

This implementation is limited to the bare minimum functionality of
doing (whole-document) formatting and rangeFormatting. The JSON parsing
is based on LLVM's YAMLParser but yet most of the code of clangd is
currently dealing with JSON serialization and deserialization.

This was only tested with VS Code so far, mileage with other LSP clients
may vary.

Differential Revision: https://reviews.llvm.org/D29451

llvm-svn: 294291
2017-02-07 10:28:20 +00:00
Jonathan Coe 5f1a2c2e0a [clang-tidy] Cleanup of no-assembler check
Address outstanding comments from https://reviews.llvm.org/D29267

llvm-svn: 294283
2017-02-07 06:19:38 +00:00
Jonathan Coe 3032d3c3f3 [clang-tidy] safety-no-assembler
Summary:
Add a new clang-tidy module for safety-critical checks.

Include a check for inline assembler.

Reviewers: Prazek, dtarditi, malcolm.parsons, alexfh, aaron.ballman, idlecode

Reviewed By: idlecode

Subscribers: idlecode, JonasToth, Eugene.Zelenko, mgorny, JDevlieghere, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D29267

llvm-svn: 294255
2017-02-06 22:57:14 +00:00
Alexander Kornienko d9fa4e95ec [clang-tidy] misc-argument-comment support for gmock
Now for real. The use case supported previously is used by approximately nobody.
What's needed is support for matching argument comments in EXPECT_xxx calls to
the names of parameters of the mocked methods.

llvm-svn: 294193
2017-02-06 15:47:17 +00:00
Alexander Kornienko 2d73022122 [clang-tidy] getPreviousNonCommentToken -> getPreviousToken
llvm-svn: 294192
2017-02-06 15:46:33 +00:00
Eric Liu 28c30ce250 [change-namespace] trying to fix build bot failure caused by r293909.
llvm-svn: 293927
2017-02-02 19:46:12 +00:00
Eric Liu 0325a77c5b [change-namespace] fix unscoped enum constant references.
Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29460

llvm-svn: 293909
2017-02-02 17:40:38 +00:00
Eric Liu ae7de7117a [change-namespace] check using shadow decl correctly when shortening namespace specifiers.
Summary:
This fixes mismatch between template decls and template specialization decls.

Also added a few more test cases.

Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29447

llvm-svn: 293897
2017-02-02 15:29:54 +00:00
Alexander Kornienko 73c69a3714 [clang-tidy] misc-argument-comment support for gmock
llvm-svn: 293845
2017-02-02 00:37:08 +00:00
Alexander Kornienko 165fe63b4e [clang-tidy] misc-argument-comment: ignore comments after arguments
llvm-svn: 293771
2017-02-01 15:28:25 +00:00
Alexander Kornienko b7a6ea3049 [clang-tidy] Remove debug logging.
llvm-svn: 293763
2017-02-01 12:41:34 +00:00
Diana Picus 9141501721 Revert "Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications."
This reverts commit r293217, its follow-up 293218 and part of 293234 because it
broke all bots that build clang-tools-extra.

llvm-svn: 293267
2017-01-27 07:19:22 +00:00
Eugene Zelenko 834bb0e3b5 [Clang-tidy documentation] Consistency (fix-it); 80 characters per line.
llvm-svn: 293234
2017-01-26 23:58:21 +00:00
Aaron Ballman abb5b7965a Correcting a typo in the test case to appease bots.
llvm-svn: 293218
2017-01-26 22:39:01 +00:00
Aaron Ballman 8ec373af3d Implement a new clang-tidy check that suggests users replace dynamic exception specifications with noexcept exception specifications.
Patch by Don Hinton.

llvm-svn: 293217
2017-01-26 22:34:24 +00:00
Eric Liu 9122916ee5 [change-namespace] correctly shorten namespace when references have leading '::'
Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29182

llvm-svn: 293187
2017-01-26 16:31:32 +00:00
Eric Liu bc715504da [change-namespace] add leading '::' to references in new namespace when name conflict is possible.
Summary:
For example, when we change 'na' to "nb::nc", we need to add leading '::' to
references "::nc::X" in the changed namespace.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D29176

llvm-svn: 293182
2017-01-26 15:08:44 +00:00
Gabor Horvath 3ac2ad7d6c [clang-tidy] Don't modernize-raw-string-literal if replacement is longer.
Fixes PR30964. The old behavior can be achieved using a setting.

Patch by: Andras Leitereg!

Differential Revision: https://reviews.llvm.org/D28667

llvm-svn: 292938
2017-01-24 15:18:11 +00:00
Alexander Kornienko 2e888fe165 [clang-tidy] Fix NOLINT test
Summary:
Test cases I've added in review D26218 were too brittle and weren't working properly.
This patch fixes this.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Nikita Kakuev!

Differential Revision: https://reviews.llvm.org/D26466

llvm-svn: 292926
2017-01-24 12:42:26 +00:00
Alexander Kornienko 4b1dfbbc78 [clang-tidy] Avoid incorrect fixes in modernize-use-using
Avoid fixes for typedefs with multiple types and for typedefs with struct
definitions. Partially addresses http://llvm.org/PR28334

llvm-svn: 292918
2017-01-24 11:41:02 +00:00
Alexander Kornienko c456e686a9 [clang-tidy] Add more tests for modernize-use-using.
llvm-svn: 292917
2017-01-24 11:40:23 +00:00
Malcolm Parsons 3de05a2fda [clang-tidy] Ignore implicit functions in performance-unnecessary-value-param
Summary:
The performance-unnecessary-value-param check mangled inherited
constructors, as the constructors' parameters do not have useful source
locations. Fix this by ignoring implicit functions.

Fixes PR31684.

Reviewers: flx, alexfh, aaron.ballman

Subscribers: madsravn, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D29018

llvm-svn: 292786
2017-01-23 13:18:08 +00:00
Felix Berger 08df246407 [clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check
Reviewers: alexfh, sbenza, malcolm.parsons

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28899

llvm-svn: 292491
2017-01-19 15:51:10 +00:00
Malcolm Parsons 9cfb973ab4 [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing
Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

Differential Revision: https://reviews.llvm.org/D28850

llvm-svn: 292484
2017-01-19 13:38:19 +00:00
Ehsan Akhgari 221ab77ff7 [clang-tidy] Add -extra-arg and -extra-arg-before to run-clang-tidy.py
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.

Reviewers: alexfh

Differential Revision: https://reviews.llvm.org/D28334

llvm-svn: 292415
2017-01-18 17:49:35 +00:00
Benjamin Kramer 1d3a91a682 [include-fixer] Don't return a correction if the header insertion failed.
This is could happen in cases involving macros and we don't want to
return an invalid fixit for it or a confusing error message with no
fixit.

llvm-svn: 292405
2017-01-18 16:22:58 +00:00
Alexander Kornienko 0d7a7cdb28 [clang-tidy] Fix crash in modernize-use-using (http://llvm.org/PR29135)
llvm-svn: 292229
2017-01-17 16:14:03 +00:00
Haojian Wu 903d35e50e Remove dead code.
llvm-svn: 292218
2017-01-17 13:46:59 +00:00
Haojian Wu 4775ce56ec [clang-move] Handle helpers with forward declarations.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28801

llvm-svn: 292215
2017-01-17 13:22:37 +00:00
Haojian Wu b3d9888449 [clang-move] Ignore using decls which are defined in macros.
Summary:
Also ignore helpers which are defined in macro. Currently clang-move doesn't
handle macro well enough, especiall for complex macros. This patch will ignore
declarations in macros to make the behavior of clang-move more correct.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28774

llvm-svn: 292207
2017-01-17 10:08:11 +00:00
Antonio Maiorano 0d7d9c20a5 Update tools to use new getStyle API
Depends on https://reviews.llvm.org/D28081

Differential Revision: https://reviews.llvm.org/D28315

llvm-svn: 292175
2017-01-17 00:13:32 +00:00
Haojian Wu 85867727fa [clang-move] Dump enum and type alias declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28293

llvm-svn: 292098
2017-01-16 09:34:07 +00:00
Malcolm Parsons e65b1029ca Remove unused lambda captures. NFC
llvm-svn: 291941
2017-01-13 19:02:50 +00:00
Malcolm Parsons 3c3ae0e6db Remove unused lambda captures. NFC
llvm-svn: 291940
2017-01-13 18:56:04 +00:00
Benjamin Kramer 5f1f6eceb3 Fix the build of the include-fixer plugin for some shared cmake builds and MSVC.
- The include fixer plugin does not directly depend on pthread, but can
pick up pthread references transitively through inlining. Just add
pthreads to the linked libs unconditionally.
- MSVC emits bogus warnings when including <future> and building without
exceptions. Blacklist the warnings explicitly.

llvm-svn: 291892
2017-01-13 10:14:07 +00:00
Hans Wennborg 07e66ad7f8 Clear the release notes for 5.0.0
llvm-svn: 291838
2017-01-12 21:58:40 +00:00
Hans Wennborg 73c01543ec Update docs/conf.py version
llvm-svn: 291832
2017-01-12 21:42:38 +00:00
Malcolm Parsons 6b3e27219e [clang-tidy] Fix check for trivially copyable types in modernize-pass-by-value
Summary:
rL270567 excluded trivially copyable types from being moved by
modernize-pass-by-value, but it didn't exclude references to them.
Change types used in the tests to not be trivially copyable.

Reviewers: madsravn, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28614

llvm-svn: 291796
2017-01-12 19:20:35 +00:00
Alexander Kornienko e3d91a5c4b Correctly classify main file includes if there is a prefix added
Summary:
Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory).

This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code.

Reviewers: hokein, alexfh

Subscribers: cfe-commits, #clang-tools-extra

Patch by Julian Bangert!

Differential Revision: https://reviews.llvm.org/D26015

llvm-svn: 291767
2017-01-12 15:31:50 +00:00
Haojian Wu ffdd072858 [find-all-symbols] Index partial template specializations.
Summary:
Fix no std::function index.

Previously, we don't index all the template specialization declarations of functions and classes (Because we assume that template functions/classes are indexed by their template declarations), but this is not always true in some cases like `std::function` which only has a partial template specialization declaration.

Reviewers: ioeric, bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27920

llvm-svn: 291669
2017-01-11 11:47:44 +00:00
Manuel Klimek a47515ec4a Improve include fixer's ranking by taking the paths into account.
Instead of just using popularity, we also take into account how similar the
path of the current file is to the path of the header.
Our first approach is to get popularity into a reasonably small scale by taking
log2 (which is roughly intuitive to how humans would bucket popularity), and
multiply that with the number of matching prefix path fragments of the included
header with the current file.
Note that currently we do not take special care for unclean paths containing
"../" or "./".

Differential Revision: https://reviews.llvm.org/D28548

llvm-svn: 291664
2017-01-11 10:32:47 +00:00
Manuel Klimek f38d74e78b Only launch asynchronously if threading is enabled.
llvm-svn: 291653
2017-01-11 07:20:46 +00:00
Benjamin Kramer bdb2171c15 [include-fixer] Load symbol index asynchronously.
We don't actually need the index until parse time, so fetch it in the
background and start parsing. By the time it is actually needed it's
likely that the loading phase has completed in the background.

llvm-svn: 291446
2017-01-09 15:18:28 +00:00
David Blaikie e83806be32 Reapply "Fix for shared_ptrification in Clang"
Aleksey Shlyapnikov pointed out the memory leak I'd introduced, so
recommitted the clang change with a fix for that.

This reapplies r291186, reverted in r291251.

llvm-svn: 291272
2017-01-06 19:49:09 +00:00
David Blaikie 2376c392f7 Revert "Fix for shared_ptrification in Clang"
The original commit caused an asan-detected memory leak in Clang.
Reverting while I investigate.

This reverts commit r291186.

llvm-svn: 291251
2017-01-06 17:47:19 +00:00
David Blaikie 201f0f5502 Fixes for Clang API change
llvm-svn: 291203
2017-01-06 01:09:06 +00:00
David Blaikie d02498c6ad Fix for shared_ptrification in Clang
llvm-svn: 291186
2017-01-05 22:44:07 +00:00
Malcolm Parsons b744ce87fc [clang-tidy] Ignore default arguments in modernize-default-member-init
Summary:
Default member initializers cannot refer to constructor parameters, but modernize-default-member-init was trying to when the default constructor had default arguments.

Change the check to ignore default arguments to the default constructor.

Fixes PR31524.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits, JDevlieghere, Eugene.Zelenko

Differential Revision: https://reviews.llvm.org/D28287

llvm-svn: 290972
2017-01-04 17:33:55 +00:00
Haojian Wu d69d90753c [clang-move] Support moving type alias declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28279

llvm-svn: 290967
2017-01-04 14:50:49 +00:00
Eric Liu ee5104bbab [change-namespace] get newlines around moved namespace right.
Summary: Previously, a `\n` might be left in the old namespace and thus not copied to the new namespace, which is bad.

Reviewers: hokein

Subscribers: alexshap, cfe-commits

Differential Revision: https://reviews.llvm.org/D28282

llvm-svn: 290966
2017-01-04 14:49:08 +00:00
Alexander Kornienko 563de799e3 [clang-tidy] Add check name to YAML export (clang-tools-extra part)
Add a field indicating the associated check for every replacement to the YAML
report generated with the '-export-fixes' option.  Update
clang-apply-replacements to handle the new format.

Patch by Alpha Abdoulaye!

Differential revision: https://reviews.llvm.org/D26137

llvm-svn: 290893
2017-01-03 14:36:13 +00:00
Haojian Wu 32a552f6b0 [clang-move] Support moving enum declarations.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28228

llvm-svn: 290891
2017-01-03 14:22:25 +00:00
Malcolm Parsons cfa7d3748e [clang-tidy] Handle constructors in performance-unnecessary-value-param
Summary:
modernize-pass-by-value doesn't warn about value parameters that
cannot be moved, so performance-unnecessary-value-param should.

Reviewers: aaron.ballman, flx, alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D28022

llvm-svn: 290883
2017-01-03 12:10:44 +00:00
Haojian Wu 3626516b14 [clang-move] Only move used helper declarations.
Summary:
Instead of moving all the helper declarations blindly, this patch
implements an AST-based call graph solution to make clang-move only move used
helper decls to new.cc and remove unused decls in old.cc.

Depends on D27674.

Reviewers: ioeric

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D27673

llvm-svn: 290873
2017-01-03 09:00:51 +00:00
James Dennett e772e06686 Extend documentation of how to test clang-tidy checks.
Summary:
The documentation assumed expertise with FileCheck; many clang-tidy check
authors may not have significant exposure to FileCheck, and so it's worth
spending a few more words here to spell things out.

Reviewers: alexfh

Subscribers: cfe-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D28189

llvm-svn: 290838
2017-01-02 21:45:34 +00:00
Gabor Horvath 7510d9aa8a [clang-tidy] Add delete null pointer check.
This check detects and fixes redundant null checks before deletes.

Patch by: Gergely Angeli!

Differential Revision: https://reviews.llvm.org/D21298

llvm-svn: 290784
2016-12-31 12:45:59 +00:00
Alexander Kornienko 2042f833fd [clang-tidy] google-explicit-constructor: ignore macros
llvm-svn: 290756
2016-12-30 15:15:14 +00:00
Alexander Kornienko 56d0806644 [clang-tidy] google-explicit-constructor: ignore template instantiations
llvm-svn: 290753
2016-12-30 13:25:03 +00:00
Mads Ravn 72bcc049f2 [clang-tidy] Add check 'misc-string-compare'.
I have a created a new check for clang tidy: misc-string-compare. This will check for incorrect usage of std::string::compare when used to check equality or inequality of string instead of the string equality or inequality operators.

Example:
```
  std::string str1, str2;
  if (str1.compare(str2)) {
  }
```

Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons

Subscribers: xazax.hun, Eugene.Zelenko, cfe-commits, malcolm.parsons, Prazek, mgorny, JDevlieghere

Differential Revision: https://reviews.llvm.org/D27210

llvm-svn: 290747
2016-12-30 10:09:46 +00:00
Gabor Horvath 6f896a9866 Fix another nondeterminism in a tidy test.
llvm-svn: 290745
2016-12-30 09:20:10 +00:00
Alexander Kornienko dd0c0ba82c [clang-tidy] google-explicit-constructor: ignore compiler-generated conversion operators.
llvm-svn: 290668
2016-12-28 13:48:03 +00:00
Malcolm Parsons 51bfe42a70 [clang-tidy] Make 2 checks register matchers for C++ only.
llvm-svn: 290633
2016-12-27 22:14:40 +00:00
Malcolm Parsons 5cc08f865b [clang-tidy] Replace dead link in modernize-pass-by-value doc
llvm-svn: 290630
2016-12-27 22:01:37 +00:00
Gabor Horvath de1f4a4496 Attempt to fix non-determinism in tests.
llvm-svn: 290605
2016-12-27 11:56:54 +00:00
Gabor Horvath 2953b42a2e [clang-tidy] Add enum misuse check.
The checker detects various cases when an enum is probably misused
(as a bitmask).

Patch by: Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D22507

llvm-svn: 290600
2016-12-27 10:07:39 +00:00
Malcolm Parsons 0cc3051d8e [clang-tidy] Remove local hasInClassInitializer matcher. NFC
llvm-svn: 290493
2016-12-24 14:30:29 +00:00
Marek Sokolowski 23dd4c37be [clang-tidy] refactor ExprSequence out of use-after-move check
Differential Revision: https://reviews.llvm.org/D27700

llvm-svn: 290489
2016-12-24 12:45:07 +00:00
Alexander Kornienko bbd8536321 [clang-tidy] Flag implicit conversion operators.
llvm-svn: 290434
2016-12-23 15:03:12 +00:00
Eric Liu 180dac6396 [change-namespace] consider namespace aliases to shorten qualified names.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28052

llvm-svn: 290421
2016-12-23 10:47:09 +00:00
Clement Courbet 4d260bf0c7 [clang-tidy] cppcoreguidelines-slicing: display discarded state size in bytes
https://reviews.llvm.org/D27212

llvm-svn: 290340
2016-12-22 14:12:31 +00:00
Alexander Kornienko b5ca17f817 [clang-tidy] Ignore `size() == 0` in the container implementation.
llvm-svn: 290289
2016-12-21 23:44:23 +00:00
Malcolm Parsons 4f392d3fa3 Comment out char16_t and char32_t tests
llvm-svn: 290210
2016-12-20 22:57:21 +00:00
Malcolm Parsons d5508b4e89 [clang-tidy] Add modernize-use-default-member-init check
Summary: Fixes PR18858

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, modocache

Differential Revision: https://reviews.llvm.org/D26750

llvm-svn: 290202
2016-12-20 21:26:07 +00:00
Eric Liu e3f35e4db6 [change-namespace] do not fix calls to overloaded operator functions.
Summary: Also make sure one function reference is only processed once.

Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27982

llvm-svn: 290176
2016-12-20 14:39:04 +00:00
Malcolm Parsons 79578cc936 [clang-tidy] Remove duplicated check from move-constructor-init
Summary:
An addition to the move-constructor-init check was duplicating the
modernize-pass-by-value check.
Remove the additional check and UseCERTSemantics option.
Run the move-constructor-init test with both checks enabled.
Fix modernize-pass-by-value false-positive when initializing a base
class.
Add option to modernize-pass-by-value to only warn about parameters
that are already values.

Reviewers: alexfh, flx, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26453

llvm-svn: 290051
2016-12-17 20:23:14 +00:00
Benjamin Kramer bc805aef33 [include-fixer] Desugar incomplete types.
This will look through typedefs so include-fixer will look up the target
of the typedef instead of the typedef itself (which is already in
scope).

llvm-svn: 289952
2016-12-16 16:09:06 +00:00
Piotr Padlewski 28da400854 [clang-tidy] fix missing anchor for MPI Module
Summary: MPIModule was not linked to plugins

Reviewers: alexfh, Alexander_Droste, hokein

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27813

llvm-svn: 289930
2016-12-16 09:14:47 +00:00
Felix Berger 519de4b692 [clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop
Summary: This fixes a bug where the performance-unnecessary-value-param check suggests a fix to move the parameter inside of a loop which could be invoked multiple times.

Reviewers: sbenza, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27187

llvm-svn: 289912
2016-12-16 02:47:56 +00:00
Eric Liu 0c0aea0c0a [change-namespace] fix a case references to templated using alias are qualified types.
llvm-svn: 289816
2016-12-15 13:02:41 +00:00
Eric Liu 26cf68af3a [change-namespace] handling templated type aliases correctly.
Summary: This fixes templated type aliases and templated type aliases in classes.

Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27801

llvm-svn: 289799
2016-12-15 10:42:35 +00:00
Malcolm Parsons 8e67aa9a9b [clang-tidy] Enhance modernize-use-auto to templated function casts
Summary:
Use auto when declaring variables that are initialized by calling a templated
function that returns its explicit first argument.

Fixes PR26763.

Reviewers: aaron.ballman, alexfh, staronj, Prazek

Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27166

llvm-svn: 289797
2016-12-15 10:19:56 +00:00
Eric Liu 4fe99e1431 [change-namespace] don't crash when type reference is in function type parameter list.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27758

llvm-svn: 289672
2016-12-14 17:01:52 +00:00
Piotr Padlewski ce452ceb6a Deleted unused typedef
llvm-svn: 289658
2016-12-14 15:42:23 +00:00
Piotr Padlewski 08124b110a modernize-use-auto NFC fixes
llvm-svn: 289656
2016-12-14 15:29:23 +00:00
Stephan Bergmann 17c7f70362 Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.

Differential Revision: https://reviews.llvm.org/D26671

llvm-svn: 289647
2016-12-14 11:57:17 +00:00
Justin Lebar 2edf6f1683 [clang-tidy] Suggest including <cmath> if necessary in type-promotion-in-math-fn-check.
Reviewers: alexfh

Subscribers: JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27748

llvm-svn: 289637
2016-12-14 06:52:23 +00:00
Justin Lebar ecb10f4a9a [ClangTidy] Add new performance-type-promotion-in-math-fn check.
Summary:
This checks for calls to double-precision math.h with single-precision
arguments.  For example, it suggests replacing ::sin(0.f) with
::sinf(0.f).

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D27284

llvm-svn: 289627
2016-12-14 03:15:01 +00:00
Bill Seurer 09d29f9e01 [powerpc] deactivate readability-identifier-naming.cpp test on powerpc64le
The test case clang-tidy/readability-identifier-naming.cpp segfaults on
powerpc64 little endian (starting with r288563) when a bootstrap build/test
is done.  To get the buildbot running again deactivate the test.
When the issue is resolved reactivate it.

llvm-svn: 289581
2016-12-13 20:26:35 +00:00
Reid Kleckner b1653c6cd7 Fix size_t typdef in new cppcoreguidelines-no-malloc.cpp test
llvm-svn: 289580
2016-12-13 20:25:47 +00:00
Alexander Kornienko a3dc05b363 Fix sphinx build.
llvm-svn: 289549
2016-12-13 16:49:10 +00:00
Alexander Kornienko 1647f3855f Remove trailing whitespace in docs and clang-tidy sources.
llvm-svn: 289547
2016-12-13 16:38:45 +00:00
Alexander Kornienko ebdfb9cf0c [Clang-tidy] check for malloc, realloc and free calls
Summary:
This checker flags the use of C-style memory management functionality and notes about modern alternatives.
In an earlier revision it tried to autofix some kind of patterns, but that was a bad idea. Since memory management can be so widespread in a program, manual updating is most likely necessary.
Maybe for special cases, there could be later additions to this basic checker.

This is the first checker I wrote and I never did something with clang (only compiling programs). So whenever I missed conventions or did plain retarded stuff, feel free to point it out! I am willing to fix them and write a better checker.

I hope the patch does work, I never did this either. On a testapply in my repository it did, but I am pretty unconfident in my patching skills :)

Reviewers: aaron.ballman, hokein, alexfh, malcolm.parsons

Subscribers: cfe-commits, JDevlieghere, nemanjai, Eugene.Zelenko, Prazek, mgorny, modocache

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D26167

Patch by Jonas Toth!

llvm-svn: 289546
2016-12-13 16:38:18 +00:00
Alexander Kornienko 9f58fe08bf Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
llvm-svn: 289542
2016-12-13 16:19:19 +00:00
Haojian Wu dc4edba576 [clang-move] Fix incorrect EndLoc for declarations in macros.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27713

llvm-svn: 289541
2016-12-13 15:35:47 +00:00
Malcolm Parsons e7be4a004b [clang-tidy] Add check for redundant function pointer dereferences
Reviewers: alexfh, aaron.ballman, hokein

Subscribers: mgorny, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27520

llvm-svn: 289524
2016-12-13 08:04:11 +00:00
Alexander Shaposhnikov b8c997f1d2 [clang-move] Fix buildbot failures
Fix the buildbot failures introduced by D27669

llvm-svn: 289465
2016-12-12 20:24:44 +00:00
Alexander Shaposhnikov 62a154dab6 [clang-move] Use appendArgumentsAdjuster for adding extra arguments
1. Remove some boilerplate code for appending -fparse-all-comments to the list of arguments.
2. Run clang-format -i against ClangMoveMain.cpp.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D27669

llvm-svn: 289464
2016-12-12 19:56:37 +00:00
Eric Liu 97f87add50 [change-namespace] always add a '::' prefix when a symbol reference needs to be fully-qualified.
llvm-svn: 288969
2016-12-07 20:08:02 +00:00
Eric Liu 8685c76472 [change-namespace] don't fix using shadow decls in classes.
Summary:
Using shadow declarations in classes always refers to base class, which does not
need to be fixed/qualified since it can be inferred from inheritance.

Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27523

llvm-svn: 288919
2016-12-07 17:04:07 +00:00
Eric Liu 41552d6a37 [change-namespace] move template class forward-declarations and don't move fwd-decls in classes.
Summary:
Forward declarations in moved namespaces should be moved back to the old
namespaces. We should also move template class forward declarations.

Also fix a bug that moves forward declarations of nested classes.

Reviewers: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27515

llvm-svn: 288908
2016-12-07 14:20:52 +00:00
Eric Liu 47a42d53fc [clang-move] ignore unsupported symbol kinds when checking if all symbols are moved.
llvm-svn: 288791
2016-12-06 10:12:23 +00:00
Eric Liu 2dd0e1bca3 [change-namespace] get changing namespace to global correct.
llvm-svn: 288662
2016-12-05 11:17:04 +00:00
Eric Liu 033b3a8b25 [clang-move] don't miss ',' in json output when there are duplicate elements.
llvm-svn: 288586
2016-12-03 15:28:03 +00:00
Felix Berger e4ab0602f2 [clang-tidy] Do not trigger unnecessary-value-param check on methods marked as final
Summary: Virtual method overrides of dependent types cannot be recognized unless
they are marked as override or final.

Exclude methods marked as final from check and add test.

Reviewers: sbenza, hokein, alexfh

Subscribers: malcolm.parsons, JDevlieghere, cfe-commits

Differential Revision: https://reviews.llvm.org/D27248

llvm-svn: 288502
2016-12-02 14:44:16 +00:00
Haojian Wu 08e402ac93 [clang-move] some tweaks.
* Don't save SourceManager for each declarations.
* Rename some out-dated methods.

No functionality change.

llvm-svn: 288498
2016-12-02 12:39:39 +00:00
Eric Liu 4bf67af2d5 Fix a buildbot failure in include-fixer.
llvm-svn: 288495
2016-12-02 11:23:07 +00:00
Malcolm Parsons 7636149f31 Add a blank line to make sphinx happy.
llvm-svn: 288384
2016-12-01 17:38:54 +00:00
Eric Liu c265b02bec [change-namespace] don't generate replacements for files that don't match file pattern.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27302

llvm-svn: 288376
2016-12-01 17:25:55 +00:00
Malcolm Parsons bcf23661d0 [clang-tidy] Rename modernize-use-default to modernize-use-equals-default
Reviewers: angelgarcia, aaron.ballman, alexfh

Subscribers: JDevlieghere, Prazek, mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D26511

llvm-svn: 288375
2016-12-01 17:24:42 +00:00
Jonas Devlieghere 7319184946 [clang-tidy] Make format style customizable
Summary: I came across an outstanding FIXME to make the format style customizable. Inspired by the include fixer, I added an new option `-style` to configure the fallback style in case no clang-format configuration file is found. The default remains "llvm". 

Reviewers: Prazek, aaron.ballman, hokein, alexfh

Subscribers: cfe-commits, malcolm.parsons

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D27142

llvm-svn: 288258
2016-11-30 18:06:42 +00:00
Benjamin Kramer 35d53951a4 [include-fixer] Don't skip repeated lookups in plugin mode.
In this mode not all the errors are fixed so it doesn't make sense to
ignore later ones.

llvm-svn: 288244
2016-11-30 14:37:40 +00:00
Eugene Zelenko 86150471c6 Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).
This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288175
2016-11-29 18:24:01 +00:00
Benjamin Kramer b2a346d5e4 [include-fixer] Don't eat one token too many when replacing a block of includes.
SourceRanges are inclusive token ranges, this was trying to form an
exclusive char range.

llvm-svn: 288145
2016-11-29 15:15:26 +00:00
Eric Liu da22b3cb8a [change-namespace] fix non-calling function references.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27208

llvm-svn: 288139
2016-11-29 14:15:14 +00:00
Benjamin Kramer 7902aa79bb [include-fixer] Don't interfere with typo correction if we found nothing.
Just let the existing typo correction machinery handle that.

llvm-svn: 288043
2016-11-28 17:16:18 +00:00
NAKAMURA Takumi 5843abc912 ClangMoveTests.cpp: Fix a bogus comparison of iterator.
msc Debug build detected it.

llvm-svn: 288034
2016-11-28 14:27:37 +00:00
Haojian Wu b15c8da089 [clang-move] Enable dump all declarations in old header.
Summary:
* Add -dump_dels option to dump all declarations from old header. It
  will allow clang-move used as a frontend to get declarations from
  header. Further more, this will make debugging stuff easier. Currently only
  class/function types are supported.
* Refactoring code a little bit by creating a ClangMoveContext which
  holds all options for ClangMoveTool, which can simplify the code in
  some degree.

Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27059

llvm-svn: 287863
2016-11-24 10:17:17 +00:00
Benjamin Kramer 1eba23b308 [clang-rename] Add test case for r287758.
llvm-svn: 287759
2016-11-23 13:14:19 +00:00
Benjamin Kramer 66039d39e1 [clang-rename] Fix non-functional offset check.
Adding something to a SourceLocation will only produce an invalid
SourceLocation in edge cases (overflow or adding 0 to an invalid one).
Check that the offset is inside the file instead and add a test case to
verify that the error message works.

llvm-svn: 287758
2016-11-23 13:10:07 +00:00
Haojian Wu 48ac304c8e [clang-move] Add some options allowing to add old/new.h to new/old.h respectively.
Summary:
* --new_depend_on_old: new header will include old header
* --old_depend_on_new: old header will include new header.

Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26966

llvm-svn: 287752
2016-11-23 10:04:19 +00:00
Benjamin Kramer b568d99dd7 [clang-rename] Prune away AST nodes more correctly and effectively when looking for a point
Due to the way the preprocessor works nodes can be half in a macro or a
different file. This means checking the file name of the start location
of a Decl is not a correct way of checking if the entire Decl is in that
file. Remove that flawed assumption and replace it with a more effective
check: If the point we're looking for is *inside* of the begin and end
location of a Decl, look inside.

This should make clang-rename more reliable (for example macro'd namespaces
threw it off before, as seen in the test case) and maybe a little faster
by pruning off more stuff that the RecursiveASTVisitor doesn't have to
drill into.

llvm-svn: 287649
2016-11-22 17:29:45 +00:00
Daniel Marjamaki 13e45e135f clang-tidy: improve my test for readability-redundant-declaration
llvm-svn: 287550
2016-11-21 16:08:17 +00:00
Daniel Marjamaki d752c44612 clang-tidy: Attempt to fix build bot failure with mismatching size_t platform type.
llvm-svn: 287546
2016-11-21 15:46:40 +00:00
Benjamin Kramer 87eb9667bf [include-fixer plugin] Make the plugin emit proper fixits in case multiple errors are found.
The standalone tool only fixes the first one and we managed to bake that
assumption into the code :(

Also fix a crash when no header is found at all.

llvm-svn: 287544
2016-11-21 15:28:50 +00:00
Daniel Marjamaki ae66045705 readability-redundant-declaration: Fix crash
Differential Revision: https://reviews.llvm.org/D26911

llvm-svn: 287540
2016-11-21 14:29:53 +00:00
Haojian Wu 50a45d9371 [clang-move] Fix not moving using-decls in global namespace in old.cc
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26844

llvm-svn: 287330
2016-11-18 10:51:16 +00:00
Benjamin Kramer 99eaf84589 [include-fixer] Add a test for the full round trip through libclang and the plugin.
llvm-svn: 287230
2016-11-17 15:23:06 +00:00
Benjamin Kramer cd2494e93f [include-fixer] Refactor include fixer to be usable as a plugin
- Refactor the external sema source into a visible class
- Add support for emitting FixIts
- Wrap up include fixer as a plugin as I did with clang-tidy

Test case will follow as soon as I wire this up in libclang.

Differential Revision: https://reviews.llvm.org/D26752

llvm-svn: 287228
2016-11-17 15:16:05 +00:00
Malcolm Parsons 5831a00634 [docs] Remove doubled spaces
Reviewers: aaron.ballman

Subscribers: nemanjai, cfe-commits

Differential Revision: https://reviews.llvm.org/D26798

llvm-svn: 287226
2016-11-17 14:26:45 +00:00
Malcolm Parsons d549e3a23c [clang-tidy] Ignore template instantiations in modernize-use-equals-delete check
Summary: Template instantiations were causing misplaced fixits.

Reviewers: aaron.ballman, alexfh, hokein

Subscribers: hokein, cfe-commits

Differential Revision: https://reviews.llvm.org/D26751

llvm-svn: 287221
2016-11-17 11:40:02 +00:00
Malcolm Parsons 5be5092c49 [clang-tidy] Changes to modernize-use-default check
Summary:
Warn about special member functions that only contain a comment.
Report the location of the special member function, unless it is
defined in a macro.  Reporting the location of the body in a macro is
more helpful as it causes the macro expansion location to be reported too.

Fixes PR30920.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26741

llvm-svn: 287215
2016-11-17 09:14:04 +00:00
Eric Fiselier 732a3e0dd1 [clang-tidy] Fix identifier naming for initializer list member initializers.
Summary:
This patch adds handling for member initializers in a constructors initializer list. Previously we only handled base-class and delegating initializers, which are transformed by the `TypeLoc` matcher. For Example:

```
// Style options: All identifiers should start with an upper case letter.
struct base { ...  }; 
struct der :  base {
  int field;  // FIXES: int Field;
  der() : der(42) {} // FIXES: Der() : Der(42) {}
  der(int X) : base(), field(X) {} // FIXES: Der(int X) : Base(), field(X)
  // Note that `field` doesn't get replaced
};
```

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26744

llvm-svn: 287153
2016-11-16 21:15:58 +00:00
Eric Liu ff51f011d1 [change-namespace] handle constructor initializer: Derived : Base::Base() {} and added conflict detections
Summary:
namespace nx { namespace ny { class Base { public: Base(i) {}} } }
namespace na {
namespace nb {
class X : public nx::ny {
public:
  X() : Base::Base(1) {}
};
}
}

When changing from na::nb to x::y, "Base::Base" will be changed to "nx::ny::Base" and
 "Base::" in "Base::Base" will be replaced with "nx::ny::Base" too, which causes
conflict. This conflict should've been detected when adding replacements but was hidden by `addOrMergeReplacement`. We now also detect conflict when adding replacements where conflict must not happen.

The namespace lookup is tricky here, we simply replace "Base::Base()" with "nx::ny::Base()" as a workaround, which compiles but not perfect.

Reviewers: hokein

Subscribers: bkramer, cfe-commits

Differential Revision: https://reviews.llvm.org/D26637

llvm-svn: 287118
2016-11-16 16:54:53 +00:00
Gabor Horvath 678dd8fc62 [clang-tidy] New check to prefer transparent functors to non-transparent ones.
llvm-svn: 287107
2016-11-16 14:42:10 +00:00
Haojian Wu 4543feceb3 [clang-move] Support moving function.
Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26665

llvm-svn: 287101
2016-11-16 13:05:19 +00:00
Malcolm Parsons 31055c6ace [clang-tidy] Handle template instantiations in modenize-use-default check
Summary:
Duplicate fixes were being created for explicit template instantiations
of out-of-line constructors or destructors.

Fixes PR30921.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26582

llvm-svn: 287091
2016-11-16 09:51:40 +00:00
Malcolm Parsons 49fe4037a1 [clang-tidy] Change readability-redundant-member-init to get base type from constructor
Summary: Fixes PR30835

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: Prazek, cfe-commits

Differential Revision: https://reviews.llvm.org/D26118

llvm-svn: 286990
2016-11-15 17:49:00 +00:00
Haojian Wu 53315a7b98 [clang-move] Make the output code look more pretty.
Summary:
Add decent blank lines between declarations:
* Add extra blank line after #define or #includes.
* Add extra blank line between declarations.
* Add extra blank line in front of #endif.

Previously, the new generated code is quite tight:

```
#ifndef FOO_H
#define FOO_H
namespace a {
class A { public: int f(); };
int A::f() { return 0; }
} // namespace a
#endif // FOO_H
```

After this patch, the code looks like:

```
#ifndef FOO_H
#define FOO_H

namespace a {
class A { public: int f(); };

int A::f() { return 0; }
} // namespace a

#endif // FOO_H
```

Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26493

llvm-svn: 286943
2016-11-15 09:06:59 +00:00
Eric Liu 3215886b7a [change-namespace] consider typedef/using alias decls in the moved namespace.
Summary: If a TypeLoc refers to a type alias defined in the moved namespace, we do not need to update its specifier since the type alias decl will be moved along with the type reference.

Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26592

llvm-svn: 286873
2016-11-14 19:37:55 +00:00
Haojian Wu 2467539800 [clang-move] Fix an incorrect range for the functions whose returned value is a macro
Summary:
Fix an incorrect range for the functions whose returned value is a macro
(e.g. `bool`). This incorrect range can lead to modifications of an unexpected
file where the macro is in.

We should use expansion location instead of spelling location.

Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26609

llvm-svn: 286833
2016-11-14 14:46:48 +00:00
Haojian Wu 35ca946760 [clang-move] Abstract a ClassMather for matching class declarations.
Summary:
No functionality change.

This is a refactoring patch, which makes the code more readable and easy
to extend it to support more types.

Reviewers: ioeric

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26515

llvm-svn: 286825
2016-11-14 14:15:44 +00:00
Eric Liu 6aa9416d06 Handle adding new nested namespace in old namespace.
Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26456

llvm-svn: 286486
2016-11-10 18:29:01 +00:00
Eric Liu 231c655851 [change-namespace] dyn_cast -> cast.
llvm-svn: 286485
2016-11-10 18:15:34 +00:00
Malcolm Parsons e293eab46f [clang-tidy] Add modernize-use-equals-delete check
Summary: Fixes PR27872

Reviewers: klimek, hokein, alexfh, aaron.ballman

Subscribers: Prazek, Eugene.Zelenko, danielmarjamaki, cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D26138

llvm-svn: 286472
2016-11-10 16:46:59 +00:00
Malcolm Parsons d784f20c13 [clang-tidy] Add missing meta refresh for cert-msc30-c doc. NFC
llvm-svn: 286466
2016-11-10 16:19:17 +00:00