Commit Graph

98 Commits

Author SHA1 Message Date
Etienne Bergeron 2a4c00f243 [clang-tidy] Cleanup namespace in utils folder.
Summary:
This is a step forward cleaning up the namespaces in clang-tidy/utils.
There is no behavior change.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 268356
2016-05-03 02:54:05 +00:00
Eugene Zelenko 7da47b8ef5 Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes.
Differential revision: http://reviews.llvm.org/D16566

llvm-svn: 258870
2016-01-26 22:32:24 +00:00
Chris Bieneman 2cc7fec76a Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"Now I am become Death, the destroyer of worlds."
-J. Robert Oppenheimer

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: cfe-commits, klimek

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

llvm-svn: 258864
2016-01-26 21:31:36 +00:00
David Blaikie e04a3da093 Revert "Apply modernize-use-default to clang-tools-extra."
Breaks the build in GCC 4.7.2 (see
http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3 for example)

This reverts commit r250824.

llvm-svn: 250862
2015-10-20 21:45:52 +00:00
Angel Garcia Gomez 3ca34bc870 Apply modernize-use-default to clang-tools-extra.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 250824
2015-10-20 12:56:27 +00:00
Angel Garcia Gomez 166935764b Fix overlapping replacements in clang-tidy.
Summary: Prevent clang-tidy from applying fixes to errors that overlap with other errors' fixes, with one exception: if one fix is completely contained inside another one, then we can apply the big one.

Reviewers: bkramer, klimek

Subscribers: djasper, cfe-commits, alexfh

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

llvm-svn: 250509
2015-10-16 11:43:49 +00:00
Benjamin Kramer ac8517c2bf [VFS] Switch clang-tidy tests to use an in-memory fs.
Again, this is both cleaner and completely removes any depedency on the
host file system.

llvm-svn: 249526
2015-10-07 08:35:23 +00:00
Angel Garcia Gomez 32af5bc51a Create interfaces and tests for the overlapping replacements fix in clang-tidy.
Summary: No changes in clang-tidy yet.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 249402
2015-10-06 13:52:51 +00:00
Alexander Kornienko ffc277989b [clang-tidy] Fix PR22785.
Fix http://llvm.org/PR22785. Bug 22785 - readability-braces-around-statements
doesn't work well with macros.

http://reviews.llvm.org/D12729

Patch by Marek Kurdej!

llvm-svn: 247163
2015-09-09 17:06:09 +00:00
Aaron Ballman 01cee3a7bd Move some more functionality into the AST consumer creation factory function, before registering matchers with the MatchFinder object. This allows us to set the language options for the ClangTidyContext object appropriately so that they can be used from registerMatchers(), and more closely models the way the clang-tidy tool works.
llvm-svn: 246660
2015-09-02 16:04:15 +00:00
Daniel Jasper 8d90e533ea 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.

llvm-svn: 245510
2015-08-19 22:04:55 +00:00
Daniel Jasper d30dc3fc75 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.

llvm-svn: 245500
2015-08-19 21:02:27 +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
Alexander Kornienko 078ab134ea [clang-tidy] Don't use delegating constructors.
llvm-svn: 245046
2015-08-14 13:23:55 +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
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 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 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
Alexander Kornienko 102d2c252a [clang-tidy] Set current main file name in tests.
llvm-svn: 243272
2015-07-27 14:54:31 +00:00
Samuel Benzaquen cfacf8ae9e [clang-tidy] Force braces around leaf 'else if' for consistency.
Summary:
Force braces around leaf 'else if' for consistency.
This complements r233697.

Reviewers: alexfh

Subscribers: curdeius, cfe-commits

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

llvm-svn: 239054
2015-06-04 16:36:58 +00:00
Samuel Benzaquen 462501ee7e Force braces on the else branch if they are being added to the if branch.
Summary:
Force braces on the else branch if they are being added to the if branch.
This ensures consistency in the transformed code.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 233697
2015-03-31 13:53:03 +00:00
Samuel Benzaquen 3199b9a8b5 Fix false positive on anonymous namespaces in headers.
Summary:
Anynoumous namespaces inject a using directive into the AST to import
the names into the containing namespace.
We should not have them in headers, but there is another warning for
that.

Reviewers: djasper

Subscribers: cfe-commits

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

llvm-svn: 233087
2015-03-24 15:21:45 +00:00
Alexander Kornienko 6658055488 [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC.
The patch was generated using this command:
$ clang-tidy/tool/run-clang-tidy.py -header-filter=.*clang-tidy.* -fix \
    -checks=-*,llvm-header-guard clang-tidy.*
$ svn revert --recursive clangt-tidy/llvm/
(to revert a few buggy fixes)

llvm-svn: 231669
2015-03-09 16:52:33 +00:00
Alexander Kornienko 333d81121d [clang-tidy] Slighly clarified a comment.
llvm-svn: 231370
2015-03-05 14:58:03 +00:00
Alexander Kornienko da4ebb219b [clang-tidy] Replace unrecognized namespace ending comments.
Summary:
Replace unrecognized namespace ending comments. This will help in particular when a namespace ending comment is mistyped or doesn't fit the regexp for other reason, e.g.:

  namespace a {
  namespace b {
  namespace {
  } // anoynmous namespace
  } // b
  } // namesapce a

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 231369
2015-03-05 14:56:11 +00:00
Alexander Kornienko ed824e0e4b [clang-tidy] Refactor: Move google clang-tidy checks to namespace clang::tidy::google
http://reviews.llvm.org/D7994

Patch by Richard Thomson!

llvm-svn: 231364
2015-03-05 13:46:14 +00:00
Daniel Jasper 136f4b3439 clang-tidy: Update test as underlying problem apparently was fixed.
llvm-svn: 230982
2015-03-02 18:07:00 +00:00
Alexander Kornienko 0a6ce9f4e1 [clang-tidy] Refactor: Move llvm clang-tidy checks to namespace clang::tidy::llvm
clang-tidy checks are organized into modules. This refactoring moves the llvm
module checks to clang::tidy::llvm

http://reviews.llvm.org/D7995

Patch by Richard Thomson!

llvm-svn: 230952
2015-03-02 12:39:18 +00:00
Alexander Kornienko 2b312420aa [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc
clang-tidy checks are organized into modules. This refactoring moves the misc
module checks into the namespace clang::tidy::misc

http://reviews.llvm.org/D7996

Patch by Richard Thomson!

llvm-svn: 230950
2015-03-02 12:25:03 +00:00
Alexander Kornienko 37f80456ce [clang-tidy] Organized clang-tidy unit tests. NFC.
* Moved unit tests for BracesAroundStatementsCheck to
    ReadabilityModuleTest.cpp.
  * Moved EXPECT_NO_CHANGES macro to ClangTidyTest.h to avoid defining it three
    times.

llvm-svn: 230947
2015-03-02 11:55:04 +00:00
Adrian Prantl b97f5c1eb2 Revert "Adapt clang-tools-extra to clang module format changes."
This reverts commit 230424.

llvm-svn: 230456
2015-02-25 02:46:37 +00:00
Adrian Prantl e95edbf5a9 Adapt clang-tools-extra to clang module format changes.
- add clangCodeGen.a to the tools that need it
- tweak pp-trace command line handling to not conflict with clang's.

llvm-svn: 230424
2015-02-25 01:32:04 +00:00
Adrian Prantl a22fd38174 Revert "Adapt Makefile dependencies for the clang module format change in r230089."
llvm-svn: 230104
2015-02-21 00:29:43 +00:00
Adrian Prantl 6897e3e456 Adapt Makefile dependencies for the clang module format change in r230089.
llvm-svn: 230090
2015-02-20 23:35:07 +00:00
Samuel Benzaquen 59c8aa92b8 Add clang-tidy check google-global-names-in-headers.
Summary:
google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.

Reviewers: alexfh

Subscribers: curdeius

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

llvm-svn: 228875
2015-02-11 21:21:05 +00:00
NAKAMURA Takumi dc872ed908 [CMake] Add dependencies on clangToolingCore.
llvm-svn: 220890
2014-10-30 00:44:01 +00:00
Daniel Jasper c1de000e22 Fix Makefiles after r220867.
llvm-svn: 220868
2014-10-29 18:55:41 +00:00
Alexander Kornienko 2192a8e519 [clang-tidy] Bring order to check registration.
Summary:
Register readability checks in a separate module. Renamed the checks
and test file names accordingly.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 220631
2014-10-26 01:41:14 +00:00
Alexander Kornienko 27f126b006 [clang-tidy] Minor fixes for the NamespaceCommentCheck.
* Make SmallVector size enough for all groups.
  * Allow trailing period in the comment.
  * Fix "// anonymous namespace qqq".

llvm-svn: 219926
2014-10-16 15:11:54 +00:00
Alexander Kornienko 81d4f939bc Fix llvm-header-guard check.
Summary:
This patch makes the check work better for LLVM code:
  * always fix existing #endif comments
  * use one space before the comment (+allow customization for other styles)

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 219789
2014-10-15 12:18:35 +00:00
Alexander Kornienko bebe0c6918 Reformatted code samples in the unit test. No functional changes.
llvm-svn: 219788
2014-10-15 11:36:48 +00:00
Alexander Kornienko 35ddae4a9b [clang-tidy] Move some of the misc checks to readability/
Summary:
Some of the misc checks belong to readability/. I'm moving them there
without changing check names for now. As the next step, I want to register some
of these checks in the google and llvm modules with suitable settings (e.g.
BracesAroundStatementsCheck). I'm not sure if we want to create a "readability"
module, probably not.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 219786
2014-10-15 10:51:57 +00:00
Manuel Klimek 81593db145 Small cleanups from review comments.
llvm-svn: 219409
2014-10-09 13:22:46 +00:00
Manuel Klimek 0551065cd1 Make clang-tidy's runCheckOnCode actually use the DiagnosticConsumer.
A precondition of that was to run both the preprocessor checks and AST
checks from the same FrontendAction, otherwise we'd have needed to
duplicate all involved objects in order to not have any references to a
deleted source manager.

llvm-svn: 219212
2014-10-07 15:49:36 +00:00
Alexander Kornienko 8f7e7f73ea [clang-tidy] Add check misc-braces-around-statements.
This check looks for if statements and loops: for, range-for, while and
do-while, and verifies that the inside statements are inside braces '{}'.
If not, proposes to add braces around them.

Example:

  if (condition)
    action();

becomes

  if (condition) {
    action();
  }

This check ought to be used with the -format option, so that the braces be
well-formatted.


Patch by Marek Kurdej!

http://reviews.llvm.org/D5395

llvm-svn: 218898
2014-10-02 19:09:56 +00:00