Alexander Kornienko
e6927b28f5
[clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245533 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 01:44:14 +00:00
Alexander Kornienko
0f9f86e56a
[clang-tidy] Fix use-after-free in UseNullptrCheck.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 23:57:34 +00:00
Alexander Kornienko
83feacd2f4
[clang-tidy] Work around failure in Darwin.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 23:03:23 +00:00
Alexander Kornienko
6e9233e3d6
[clang-tidy] Add modernize-use-nullptr check, attempt 2.
...
This patch re-applies r245434 and r245471 reverted in r245493, and changes the
way custom null macros are configured. The test for custom null macros is
temporarily excluded and will be committed separately to reduce chances of
breakages.
Initial patches by Angel Garcia.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245511 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:21:37 +00:00
Daniel Jasper
3a2a8fe9a1
Remove empty destructors added in r245500. I got confused by my
...
YouCompleteMe setup which apparently doesn't find the base classes and
thus doesn't understand that there is an implicit virtual destructor.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:04:55 +00:00
Daniel Jasper
4ecd3790a1
Fix IncludeInserter to allow for more than one added header per file.
...
Also adapt tests a bit to make it possible to test this. Removed
checking the number of errors reported per test. It was never actually
checked and doesn't seem particularly relevant to the test itself.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 21:02:27 +00:00
Justin Bogner
95bfe5b6b8
Revert "[clang-tidy] Add use-nullptr check to clang-tidy."
...
The new test is failing on darwin:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10339/
This reverts r245434 and its follow up r245471.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 20:30:07 +00:00
Aaron Ballman
d669877b0a
Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 20:26:22 +00:00
Aaron Ballman
71a2654a9a
Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 19:29:23 +00:00
Alexander Kornienko
474d21c110
[clang-tidy] Fix a bug in UseNullptrCheck.
...
http://reviews.llvm.org/D12162
Patch by Angel Garcia!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:50:22 +00:00
Alexander Kornienko
be2c671327
[clang-tidy] Fix LoopConvertCheck bug.
...
Fix LoopConvertCheck bug: StringRef to temporaries.
Also add LLVM_ATTRIBUTE_UNUSED to ModernizeModuleAnchorDestination.
http://reviews.llvm.org/D12157
Patch by Angel Garcia!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245458 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 16:54:51 +00:00
NAKAMURA Takumi
e8b6bc07f8
clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease targeting msvc.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245435 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 13:22:58 +00:00
Alexander Kornienko
3d0e75d69e
[clang-tidy] Add use-nullptr check to clang-tidy.
...
Move UseNullptr from clang-modernize to modernize module in clang-tidy.
http://reviews.llvm.org/D12081
Patch by Angel Garcia!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 13:13:12 +00:00
Alexander Kornienko
89b8288d86
[clang-tidy] Add new IdentifierNaming check
...
This check will try to enforce coding guidelines on the identifiers naming.
It supports lower_case, UPPER_CASE, camelBack and CamelCase casing and
tries to convert from one to another if a mismatch is detected.
It also supports a fixed prefix and suffix that will be prepended or appended
to the identifiers, regardless of the casing.
Many configuration options are available, in order to be able to create
different rules for different kind of identifier. In general, the
rules are falling back to a more generic rule if the specific case is not
configured.
http://reviews.llvm.org/D10933
Patch by Beren Minor!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 11:15:36 +00:00
Alexander Kornienko
f95ab50039
[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!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 09:11:46 +00:00
Ehsan Akhgari
443f869aae
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
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245401 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 02:05:37 +00:00
Aaron Ballman
b6f1d04f58
We no longer need a custom matcher for this; use the builtin AST matcher instead. NFC, and existing tests should cover this change.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 20:27:44 +00:00
Alexander Kornienko
a61c18f432
[clang-tidy] Fixed typos and formatting in a comment. NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245310 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 16:43:07 +00:00
Alexander Kornienko
acc884669b
[clang-tidy] Fix a use-after-free.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245215 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 11:27:11 +00:00
Alexander Kornienko
deefe2ca66
[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!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-17 10:03:27 +00:00
NAKAMURA Takumi
9d6774143e
clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Tweak not to override -std=c++11.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245147 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-15 02:27:22 +00:00
NAKAMURA Takumi
a34cc6e6af
clang-tools-extra/test/clang-tidy/modernize-pass-by-value.cpp: Appease targeting MS to give -fno-delayed-template-parsing.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245146 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-15 02:05:49 +00:00
NAKAMURA Takumi
924b71f5c8
clangTidyModernizeModule: Update libdeps.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245144 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-15 01:32:15 +00:00
Alexander Kornienko
844122ab7c
[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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 14:31:31 +00:00
Daniel Jasper
3b7db21bf4
misc-unused-parameters: Fix crasher with C forward declarations that
...
can leave out the parameter list.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245048 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 13:39:57 +00:00
Alexander Kornienko
b346722d21
[clang-tidy] Don't use delegating constructors.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245046 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 13:23:55 +00:00
Alexander Kornienko
78f15552b8
[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!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245045 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 13:17:11 +00:00
Alexander Kornienko
cf64efd558
[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!
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245042 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 12:33:25 +00:00
Manuel Klimek
3d8ea2bedf
Fix formatting.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244876 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 09:09:28 +00:00
Alexander Kornienko
df70b2be5e
[clang-tidy] Make FileOptionsProvider fields protected to make extending it easier
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 19:29:57 +00:00
Daniel Jasper
d8db79cb34
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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 13:16:41 +00:00
Manuel Klimek
178caf7f76
Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244722 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12 07:57:16 +00:00
David Blaikie
4783692d5d
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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 20:21:45 +00:00
Manuel Klimek
6ca6d0f086
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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 14:21:26 +00:00
NAKAMURA Takumi
cdbaed0777
Also ClangTidyTests requires clangLex.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244599 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 13:16:51 +00:00
Manuel Klimek
8bc93b0d43
Fix strict dependency uncovered by windows bot.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 13:11:29 +00:00
Manuel Klimek
91e3679539
Do not use inheriting constructors.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 12:59:22 +00:00
Manuel Klimek
bbdbc223ff
Default initialize from explicitly constructed object.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 12:13:15 +00:00
Manuel Klimek
77e6340d16
Fix shadowing of type with variable.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 12:02:28 +00:00
Manuel Klimek
9340f00dcb
Add an IncludeInserter to clang-tidy.
...
Will be used to allow checks to insert includes at the right position.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 11:37:48 +00:00
Daniel Jasper
f73aa43db7
misc-unused-parameters: Don't touch K&R style functions.
...
We couldn't calculate the removal ranges properly at this point.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 15:45:46 +00:00
Yaron Keren
25cc742208
Silence gcc 5.1 unused variable warnings using LLVM_ATTRIBUTE_UNUSED.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 16:37:34 +00:00
Aaron Ballman
3d10010a6e
Correcting and adding tests for r244206.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244208 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 12:15:47 +00:00
Aaron Ballman
4ac5595dd0
Add the "quit" command as a way to terminate clang-query interactive sessions.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 11:56:57 +00:00
Tanya Lattner
4d2f6f7111
Update references to new lists.llvm.org mailing lists.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@244001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 03:56:44 +00:00
Alexander Kornienko
15e984cf7c
[clang-tidy] Improve the misc-unused-alias-decl message
...
"this namespace alias decl is unused" -> "namespace alias decl '...' is unused"
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@243906 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 22:02:08 +00:00
Daniel Jasper
9a162e407f
Replace callback-if with isExpansionInMainFile as suggested in post
...
commit review.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@243871 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 10:52:27 +00:00
Daniel Jasper
8658dd2f3d
Add missing 'override'.
...
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@243773 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 18:32:38 +00:00
Daniel Jasper
9bd642b01f
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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@243754 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 16:08:10 +00:00
Alexander Kornienko
f2465110fd
[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
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@243747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 13:34:58 +00:00