Alexander Kornienko
0497084b69
[clang-tidy] Add loop-convert check to clang-tidy.
...
Move LoopConvert from clang-modernize to modernize module in clang-tidy.
http://reviews.llvm.org/D12076
Patch by Angel Garcia!
llvm-svn: 245427
2015-08-19 09:11:46 +00:00
Ehsan Akhgari
c62c639610
Insert override at the same line as the end of the function declaration
...
Summary:
The existing check converts the code pattern below:
void f()
{
}
to:
void f()
override {
}
which is fairly sub-optimal. This patch fixes this by inserting the
override keyword on the same line as the function declaration if
possible, so that we instead get:
void f() override
{
}
We do this by looking for the last token before the start of the body
and inserting the override keyword at the end of its location. Note
that we handle const, volatile and ref-qualifiers correctly.
Test Plan: Includes an automated test.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D9286
llvm-svn: 245401
2015-08-19 02:05:37 +00:00
Aaron Ballman
73a8f05e5d
We no longer need a custom matcher for this; use the builtin AST matcher instead. NFC, and existing tests should cover this change.
...
llvm-svn: 245340
2015-08-18 20:27:44 +00:00
Alexander Kornienko
fc8cd685e1
[clang-tidy] Fixed typos and formatting in a comment. NFC
...
llvm-svn: 245310
2015-08-18 16:43:07 +00:00
Alexander Kornienko
e0c900ed05
[clang-tidy] Fix a use-after-free.
...
llvm-svn: 245215
2015-08-17 11:27:11 +00:00
Alexander Kornienko
65eccb463d
[clang-tidy] Allow use of -list-checks option without need to pass source files.
...
Initialize CommonOptionsParser with ZeroOrOne NumOccurrenceFlag so callers can
pass -list-checks without the need to pass additional positional parameters,
then add dummy file if none were supplied.
http://reviews.llvm.org/D12070
Patch by Don Hinton!
llvm-svn: 245205
2015-08-17 10:03:27 +00:00
NAKAMURA Takumi
caad877d3e
clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Tweak not to override -std=c++11.
...
llvm-svn: 245147
2015-08-15 02:27:22 +00:00
NAKAMURA Takumi
654c2bbaf5
clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Appease targeting MS to give -fno-delayed-template-parsing.
...
llvm-svn: 245146
2015-08-15 02:05:49 +00:00
NAKAMURA Takumi
fe745cad47
clangTidyModernizeModule: Update libdeps.
...
llvm-svn: 245144
2015-08-15 01:32:15 +00:00
Alexander Kornienko
5f252cac51
[clang-tidy] Move IncludeSorter.* and IncludeInserter.* to clang-tidy/utils/
...
This is better structurally and it also fixes a linker error in the configure
build.
llvm-svn: 245052
2015-08-14 14:31:31 +00:00
Daniel Jasper
ea223a7a6a
misc-unused-parameters: Fix crasher with C forward declarations that
...
can leave out the parameter list.
llvm-svn: 245048
2015-08-14 13:39:57 +00:00
Alexander Kornienko
078ab134ea
[clang-tidy] Don't use delegating constructors.
...
llvm-svn: 245046
2015-08-14 13:23:55 +00:00
Alexander Kornienko
fc650864ef
[clang-tidy] Create clang-tidy module modernize. Add pass-by-value check.
...
This is the first step for migrating cppmodernize to clang-tidy.
http://reviews.llvm.org/D11946
Patch by Angel Garcia!
llvm-svn: 245045
2015-08-14 13:17:11 +00:00
Alexander Kornienko
8cc024ee37
[clang-tidy] Fix IncludeInserter/IncludeSorter bug.
...
If there weren't any includes in the file, or all of them had 'IncludeKind'
greater than the desired one, then 'CreateIncludeInsertion' didn't work.
http://reviews.llvm.org/D12017
Patch by Angel Garcia!
llvm-svn: 245042
2015-08-14 12:33:25 +00:00
Manuel Klimek
0a19e90b49
Fix formatting.
...
llvm-svn: 244876
2015-08-13 09:09:28 +00:00
Alexander Kornienko
b7029d05a1
[clang-tidy] Make FileOptionsProvider fields protected to make extending it easier
...
llvm-svn: 244793
2015-08-12 19:29:57 +00:00
Daniel Jasper
4d871f99c7
Lazily initialize HeaderFilter in ClangTidyDiagnosticConsumer. This
...
removes a corner case in tests that don't set the diagnostic consumer.
In tests, it is good, not to set the diagnostic consumer so that Clang's
parsing diagnostics are still displayed in the test output and only
ClangTidy's output is analyzed differently.
llvm-svn: 244745
2015-08-12 13:16:41 +00:00
Manuel Klimek
9b2c45398f
Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.
...
llvm-svn: 244722
2015-08-12 07:57:16 +00:00
David Blaikie
2f1d01954c
Revert the diagnostic improvements in r244602 as they introduced a problematic dependency
...
Seems we had some internal uses that include ClangTidyTest.h and weren't
ready for a gtest dependency. Reverting to give Manuel some time to look
into it.
llvm-svn: 244658
2015-08-11 20:21:45 +00:00
Manuel Klimek
e8c8d887be
1. Disable tests that currently cannot work on windows due to missing path canonicalization in the file manager.
...
2. Add better output when a clang-tidy unit test fails so it's clear what the error is.
llvm-svn: 244602
2015-08-11 14:21:26 +00:00
NAKAMURA Takumi
81f1ffdbbb
Also ClangTidyTests requires clangLex.
...
llvm-svn: 244599
2015-08-11 13:16:51 +00:00
Manuel Klimek
3d67c88506
Fix strict dependency uncovered by windows bot.
...
llvm-svn: 244598
2015-08-11 13:11:29 +00:00
Manuel Klimek
46e82c3dcd
Do not use inheriting constructors.
...
llvm-svn: 244597
2015-08-11 12:59:22 +00:00
Manuel Klimek
f60364326c
Default initialize from explicitly constructed object.
...
llvm-svn: 244596
2015-08-11 12:13:15 +00:00
Manuel Klimek
795daa2e8f
Fix shadowing of type with variable.
...
llvm-svn: 244587
2015-08-11 12:02:28 +00:00
Manuel Klimek
d00d6f1d43
Add an IncludeInserter to clang-tidy.
...
Will be used to allow checks to insert includes at the right position.
llvm-svn: 244586
2015-08-11 11:37:48 +00:00
Daniel Jasper
b3a74c659b
misc-unused-parameters: Don't touch K&R style functions.
...
We couldn't calculate the removal ranges properly at this point.
llvm-svn: 244454
2015-08-10 15:45:46 +00:00
Yaron Keren
43b7ca7b43
Silence gcc 5.1 unused variable warnings using LLVM_ATTRIBUTE_UNUSED.
...
llvm-svn: 244329
2015-08-07 16:37:34 +00:00
Aaron Ballman
3abb97e4c6
Correcting and adding tests for r244206.
...
llvm-svn: 244208
2015-08-06 12:15:47 +00:00
Aaron Ballman
5890717e70
Add the "quit" command as a way to terminate clang-query interactive sessions.
...
llvm-svn: 244206
2015-08-06 11:56:57 +00:00
Tanya Lattner
9aad4380ea
Update references to new lists.llvm.org mailing lists.
...
llvm-svn: 244001
2015-08-05 03:56:44 +00:00
Alexander Kornienko
2644cae3d5
[clang-tidy] Improve the misc-unused-alias-decl message
...
"this namespace alias decl is unused" -> "namespace alias decl '...' is unused"
llvm-svn: 243906
2015-08-03 22:02:08 +00:00
Daniel Jasper
cf452e5501
Replace callback-if with isExpansionInMainFile as suggested in post
...
commit review.
llvm-svn: 243871
2015-08-03 10:52:27 +00:00
Daniel Jasper
0aeed7c0b8
Add missing 'override'.
...
llvm-svn: 243773
2015-07-31 18:32:38 +00:00
Daniel Jasper
bb42b03021
Add misc-unused-alias-decls check that currently finds unused namespace
...
alias declarations. In the future, we might want to reuse it to also
fine unsed using declarations and such.
llvm-svn: 243754
2015-07-31 16:08:10 +00:00
Alexander Kornienko
b4fbb173f0
[clang-tidy] Support replacements in macro arguments in misc-inefficient-algorithm
...
Summary:
Support replacements in macro arguments in the
misc-inefficient-algorithm check.
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D11677
llvm-svn: 243747
2015-07-31 13:34:58 +00:00
NAKAMURA Takumi
0dae64a554
Move an extra switch to clang-tools-extra/test/clang-tidy/misc-unused-parameters.cpp from check_clang_tidy.sh.
...
It also rolls back r242984 and r242985.
llvm-svn: 243491
2015-07-28 22:41:04 +00:00
Daniel Jasper
542482e63d
misc-unused-parameters: Only remove parameters in the main source file.
...
In headers, they might always be pulled in to different TUs, even if
they are declared static or nested in an unnamed namespace.
llvm-svn: 243414
2015-07-28 13:19:12 +00:00
Daniel Jasper
718029ba6b
misc-unused-parameters: Properly handle static class members.
...
Not sure why I wrote what I wrote before.
llvm-svn: 243403
2015-07-28 10:39:25 +00:00
Alexander Kornienko
102d2c252a
[clang-tidy] Set current main file name in tests.
...
llvm-svn: 243272
2015-07-27 14:54:31 +00:00
Aaron Ballman
6db02dd8f0
Trying again to a failing test the bots found with r243266.
...
llvm-svn: 243269
2015-07-27 13:59:24 +00:00
Aaron Ballman
84b1b00926
Fixing a failing test the bots found with r243266.
...
llvm-svn: 243268
2015-07-27 13:47:35 +00:00
Daniel Jasper
9fe55a32b7
misc-unused-parameters: Don't warn on ParmVarDecls in the return type.
...
As there don't seem to be a good way of formulating a matcher that
finds all pairs of functions and their ParmVarDecls, just match on
functionDecls and iterate over their parameters. This should also be
more efficient as some checks are only performed once per function.
llvm-svn: 243267
2015-07-27 13:46:37 +00:00
Aaron Ballman
5a4892b4fa
Updating the documentation for clang-tidy. Removes some non-ASCII characters from the documentation, and removes shell-specific single quote characters as they cause issues for some shells (such as on Windows).
...
llvm-svn: 243266
2015-07-27 13:41:30 +00:00
Alexander Kornienko
ae8f23efa8
[clang-tidy] Don't duplicate the leading slash.
...
llvm-svn: 243265
2015-07-27 13:07:50 +00:00
Daniel Jasper
1c6fc3b8f0
misc-unused-parameters: Fix bug where the check was looking at
...
ParmVarDecls of function types.
llvm-svn: 243026
2015-07-23 17:26:36 +00:00
NAKAMURA Takumi
4c8342b73e
Fix the shell script check_clang_tidy.sh in r242984.
...
llvm-svn: 242985
2015-07-23 06:03:40 +00:00
NAKAMURA Takumi
d4ed83aae7
Appease test/clang-tidy/misc-unused-parameters.cpp for targeting *-win32, to add -fno-delayed-template-parsing.
...
Note, clang-tidy tests wouldn't run on Windows hosts since they are disabled with REQUIRES:shell.
The failure would be raised with cross building.
llvm-svn: 242984
2015-07-23 05:52:02 +00:00
Daniel Jasper
9b46e9c5de
misc-unused-parameters: Fix handling of parameters in template functions.
...
The parameters of the function templates were being marked as
incorrectly be marked as unused. Added a test for this and changed the
check to use the same
isReferenced() || !getDeclName()
logic as Sema::DiagnoseUnusedParameters.
Patch Scott Wallace, thank you!
llvm-svn: 242912
2015-07-22 17:30:35 +00:00
Daniel Jasper
82efabbb27
Extend misc-unused-parameters to delete parameters of local functions.
...
Also see: llvm.org/PR24180.
llvm-svn: 242659
2015-07-20 03:42:38 +00:00