Commit Graph

863 Commits

Author SHA1 Message Date
Alexander Kornienko e94b7c24c8 [clang-tidy] Use shrink_to_fit instead of copy and swap trick
The shrink_to_fit() method is more readable and more effective than
the copy and swap trick to reduce the capacity of a shrinkable container.
Note that, the shrink_to_fit() method is only available in C++11 and up.

Example:

std::vector<int>(v).swap(v); will be replaced with v.shrink_to_fit();

http://reviews.llvm.org/D7087

Patch by Gábor Horváth!

llvm-svn: 226912
2015-01-23 15:10:37 +00:00
Alexander Kornienko a6354cae56 [clang-tidy] Small readability-container-size-empty cleanup
Utilized the hasEitherOperand instead of explicit anyOf.

http://reviews.llvm.org/D7142

Patch by Gábor Horváth!

llvm-svn: 226911
2015-01-23 14:43:06 +00:00
Alexander Kornienko bf87a8b714 Replace size call with empty call where appripriate in clang/tools/extra
This patch is the result of applying fixes of the ContainerSizeEmpty Clang-Tidy
checker which was committed recently.

http://reviews.llvm.org/D7085

Patch by Gábor Horváth!

llvm-svn: 226817
2015-01-22 13:14:29 +00:00
Alexander Kornienko 96e7b8b0c9 [clang-tidy] Use actual LangOptions.
llvm-svn: 226812
2015-01-22 12:40:47 +00:00
Alexander Kornienko febfd3453e [clang-tidy] Minor cleanups in readability-container-size-empty checker
* Removed an unused header
  * Simplified the custom ast_matchers

http://reviews.llvm.org/D7088

Patch by Gábor Horváth!

llvm-svn: 226810
2015-01-22 12:27:09 +00:00
Alexander Kornienko 9115a3af02 [clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.
Returning by reference limits possible implementations and doesn't bring any
benefits as all callers make copies of the returned value anyway.

llvm-svn: 226553
2015-01-20 09:48:51 +00:00
Alexander Kornienko 4babd689f9 clang-tidy: 'size' call that could be replaced with 'empty' on STL containers
We are porting some of the checkers at a company we developed to the Clang Tidy
infrastructure. We would like to open source the checkers that may be useful
for the community as well. This patch is the first checker that is being ported
to Clang Tidy. We also added fix-it hints, and applied them to LLVM:
http://reviews.llvm.org/D6924

The code compiled and the unit tests are passed after the fixits was applied.

The documentation of the checker:

/// The emptiness of a container should be checked using the empty method
/// instead of the size method. It is not guaranteed that size is a
/// constant-time function, and it is generally more efficient and also shows
/// clearer intent to use empty. Furthermore some containers may implement the
/// empty method but not implement the size method. Using empty whenever
/// possible makes it easier to switch to another container in the future.

It also uses some custom ASTMatchers. In case you find them useful I can submit
them as separate patches to clang. I will apply your suggestions to this patch.

http://reviews.llvm.org/D6925

Patch by Gábor Horváth!

llvm-svn: 226172
2015-01-15 15:46:58 +00:00
Daniel Jasper 3b6018b9f6 clang-tidy: Add initial check for "Don't use else after return".
As per the LLVM coding standards:
http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

Initial version, probably still quite a bit to do until this is really
useful.

Review: http://reviews.llvm.org/D6927
llvm-svn: 226025
2015-01-14 19:37:54 +00:00
Hans Wennborg 859ea8056d docs/conf.py: bump version to 3.7
llvm-svn: 226015
2015-01-14 18:32:20 +00:00
Chandler Carruth 3cbd71c03b [cleanup] Re-sort the #include lines with llvm/utils/sort_includes.py
No functionality changed, this is just a mechanical cleanup to keep the
order of #include lines consistent across the project.

llvm-svn: 225976
2015-01-14 11:24:38 +00:00
Daniel Jasper 0c7e93c128 Make LoopConvert work with containers that are used like arrays.
llvm-svn: 225629
2015-01-12 13:17:56 +00:00
Daniel Jasper 02c9153009 clang-tidy: [misc-use-override] Simplify regular expressions in test.
No functional changes.

llvm-svn: 225520
2015-01-09 14:10:15 +00:00
Daniel Jasper e73cfbf6ba clang-tidy: [misc-use-override] Fix 'override' insertion.
Before:
  void f() __attribute__((override unused))

After:
  void f() override __attribute__((unused))

llvm-svn: 225519
2015-01-09 13:56:35 +00:00
Alexander Kornienko 284c249a63 Fixed a typo in a comment. NFC.
llvm-svn: 224581
2014-12-19 15:37:02 +00:00
Richard Smith 2cf124a9f3 Update to match clang r223913.
llvm-svn: 223914
2014-12-10 03:10:06 +00:00
Alexander Kornienko b0a9b70373 [clang-tidy] Fix a typo.
llvm-svn: 223777
2014-12-09 15:02:17 +00:00
Alexander Kornienko 423236bf0b [clang-tidy] Extended the example check, added a fix-it, etc.
llvm-svn: 223771
2014-12-09 12:43:09 +00:00
Daniel Jasper 4ecc8b30af clang-tidy: Add a basic python script to generate checks.
There are still a vast range of improvements that can be done to this,
but it seems like an ok initial version. Suggestions or patches are
highly welcome.

llvm-svn: 223766
2014-12-09 10:02:51 +00:00
Nikola Smiljanic 76c21b5a27 Handle newlines on Windows correctly.
llvm-svn: 223750
2014-12-09 02:57:56 +00:00
Alexander Kornienko 980385095e [clang-tidy] google-runtime-int: Don't check C code.
llvm-svn: 223651
2014-12-08 11:17:25 +00:00
Alexander Kornienko bc0c423a46 [clang-tidy] Add clang-tidy check for unique_ptr's reset+release -> move
Replace x.reset(y.release()); with x = std::move(y);
If y is rvalue, replace with x = y; instead.

http://reviews.llvm.org/D6485

Patch by Alexey Sokolov!

llvm-svn: 223460
2014-12-05 11:59:05 +00:00
Alexander Kornienko d365731dd0 Make ArgumentsAdjuster an std::function (clang-tools-extra part of D6505).
Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 223249
2014-12-03 17:53:03 +00:00
Alexander Kornienko 5c423318c9 [clang-tidy] Update help messages and docs.
Fixed incorrect examples of configuration, clarified the usage of -dump-config.

llvm-svn: 223235
2014-12-03 14:03:03 +00:00
Alexander Kornienko 4cf0c18a5b [clang-tidy] Make a test independent of the default check set.
llvm-svn: 223232
2014-12-03 13:48:46 +00:00
Richard Smith 4742353414 Update and simplify to match Clang r223095.
llvm-svn: 223098
2014-12-02 00:32:02 +00:00
Alexander Kornienko ad5074df0c [clang-tidy] google-explicit-constructor: don't match in template instantiations
This helps avoiding false positives related to the recently added
std::initializer_list<> handling.

llvm-svn: 222981
2014-11-30 19:41:41 +00:00
Alexander Kornienko 18bc3bf830 [clang-tidy] More tests for the google-explicit-constructor check
llvm-svn: 222924
2014-11-28 17:31:51 +00:00
Alexander Kornienko 15c5e6a597 [clang-tidy] Support initializer_list in google-explicit-constructor check
Summary:
According to the Google C++ Style Guide, constructors taking a single
std::initializer_list<> should not be marked explicit.

This change also changes the messages according to conventions used in Clang
diagnostics: no capitalization of the first letter, no trailing dot.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 222878
2014-11-27 11:11:47 +00:00
Daniel Jasper a3ec1a3267 clang-tidy: [misc-use-override] Add testcase with reversed attribute order
llvm-svn: 222755
2014-11-25 12:32:14 +00:00
Daniel Jasper 4525be4ebc clang-tidy: Add override before the first attribute.
Apparently attributes aren't sorted by source location.

llvm-svn: 222751
2014-11-25 10:45:23 +00:00
Alexander Kornienko b1f871cdcb [clang-tidy] Set google-readability-namespace-comments.ShortNamespaceLines to 10
This value is used in cpplint, so we'd better be consistent.

llvm-svn: 222431
2014-11-20 15:05:32 +00:00
Alexander Kornienko fc1dafba60 [clang-tidy] Count errors in ClangTidyDiagnosticConsumer
This re-applies r222363 reverted in r222390 after compilation errors in our
out-of-tree clang-tidy tests were fixed.

llvm-svn: 222427
2014-11-20 12:05:51 +00:00
Hans Wennborg b4986e5a44 Revert r222363: "[clang-tidy] Count errors in ClangTidyDiagnosticConsumer"
This was causing clang-tidy invocations that would previously pass despite
source errors to fail.

llvm-svn: 222390
2014-11-19 22:02:11 +00:00
Alexander Kornienko efa443429d [clang-tidy] Count errors in ClangTidyDiagnosticConsumer
llvm-svn: 222363
2014-11-19 16:07:26 +00:00
David Blaikie 34318816e8 Update for LLVM API change to make Small(Ptr)Set::insert return pair<iterator, bool> as per the C++ standard's associative container concept.
llvm-svn: 222336
2014-11-19 07:49:54 +00:00
David Blaikie 8e6cf9e579 Remove uses of StringMap::GetOrCreateValue in favor of stl-compatible API usage
llvm-svn: 222305
2014-11-19 03:05:07 +00:00
David Blaikie 206b15b2e4 Update for LLVM API change
llvm-svn: 222304
2014-11-19 03:04:29 +00:00
Alexander Kornienko b23eb5e3f7 [clang-tidy] Move the missing namespace comment warnings to the closing brace
Summary:
The google-readability-namespace-comments/llvm-namespace-comment
warnings are quite confusing when they appear at the beginning of a long
namespace and the closing brace is not in sight.

For convenience added notes pointing to the start of the namespace.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 222145
2014-11-17 17:32:32 +00:00
David Blaikie 0ee6800a31 Remove some redundant virtual on overridden functions
llvm-svn: 222027
2014-11-14 19:27:22 +00:00
Alexander Kornienko e553a93ba8 Regression test for the --serialize-diagnostics problem fixed in r221884.
llvm-svn: 221885
2014-11-13 13:09:16 +00:00
Alexander Kornienko e20ce07a2f [clang-tidy] google-readability-function: skip std::nullptr_t
Parameters of type std::nullptr_t can only have one value, so it doesn't make
sense to name them.

llvm-svn: 221340
2014-11-05 11:08:39 +00:00
Alexander Kornienko ddf9767a49 [clang-tidy] Don't print a message if there's no error.
llvm-svn: 221272
2014-11-04 15:25:22 +00:00
Rafael Espindola ecc2ebe846 Use findProgramByName. NFC.
llvm-svn: 221260
2014-11-04 12:48:22 +00:00
Alexander Kornienko 5eac3c6a44 [clang-tidy] Added -fix-errors option
Summary:
Added -fix-errors option to allow applying fixes when compiler errors
are present. Without this flag -fix would bail out if there are compiler errors.
This is needed to avoid applying wrong fixes if Clang fails to recover from
compilation errors correctly.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 221152
2014-11-03 14:06:31 +00:00
NAKAMURA Takumi 5f687a036f [CMake] clangApplyReplacement: Add clangAST in libdeps to appease msc builder.
clangApplyReplacements.lib(ApplyReplacements.cpp.obj) : error LNK2001: unresolved external symbol "private: void __thiscall clang::APValue::DestroyDataAndMakeUninit(void)" (?DestroyDataAndMakeUninit@APValue@clang@@AAEXXZ)

They are not seen in mingw dll build. Investigating.

llvm-svn: 220895
2014-10-30 03:22:32 +00:00
NAKAMURA Takumi 9f99a7a417 [CMake] Prune redundant libdeps.
llvm-svn: 220893
2014-10-30 01:37:44 +00:00
NAKAMURA Takumi dc872ed908 [CMake] Add dependencies on clangToolingCore.
llvm-svn: 220890
2014-10-30 00:44:01 +00:00
NAKAMURA Takumi 90c67e5ab4 [CMake] Reformat.
llvm-svn: 220888
2014-10-30 00:43:33 +00:00
Daniel Jasper c1de000e22 Fix Makefiles after r220867.
llvm-svn: 220868
2014-10-29 18:55:41 +00:00
Alexander Kornienko 50ab15654e Shrink the set of checks enabled by default.
Summary:
Enable only compiler diagnostics and safe static analyzer checks by
default. Let the defaults be conservative and safe for an average project.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 220865
2014-10-29 18:25:09 +00:00
NAKAMURA Takumi 633239023c Suppress clang-tools-extra/test/clang-tidy/file-filter.cpp on win32 for investigaitng.
llvm-svn: 220837
2014-10-29 05:19:55 +00:00
Alexander Kornienko e15b004922 [clang-tidy] Updated docs for r220826.
llvm-svn: 220830
2014-10-28 22:43:33 +00:00
Alexander Kornienko 37f7abe424 [clang-tidy] Added -system-headers option.
Added -system-headers option to allow display of warnings from system headers.
This is needed for testing libcxx, for example.

llvm-svn: 220826
2014-10-28 22:16:13 +00:00
NAKAMURA Takumi 729be14435 Prune CRLF.
llvm-svn: 220678
2014-10-27 12:37:26 +00:00
Alexander Kornienko 106c8e0898 [clang-tidy] check_clang_tidy_fix.sh -> check_clang_tidy.sh
Summary: Make the script suitable for checking just messages. Move most of the tests to use it. Clean up the tests: shorten messages, insert line numbers, remove unnecessary RUN: lines, etc.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 220634
2014-10-26 02:58:07 +00:00
Alexander Kornienko 6775ce3ad3 [clang-tidy] Clean up test.
Simplify RUN lines and make checks stricter, check messages instead of fixes.

llvm-svn: 220633
2014-10-26 02:21:32 +00:00
Alexander Kornienko 2dd21acab4 [clang-tidy] Simplify RUN: lines in the test
llvm-svn: 220632
2014-10-26 02:18:06 +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
Samuel Benzaquen aedd994560 Add flag --enable-check-profile to clang-tidy.
Summary:
Add flag --enable-check-profile to clang-tidy.
It turns on per-matcher profiles in MatchFinder and prints a report to
stderr at the end.

Reviewers: alexfh

Subscribers: curdeius, cfe-commits

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

llvm-svn: 220491
2014-10-23 17:23:20 +00:00
Alexander Kornienko 4f6b06673d [clang-tidy] Add support for custom configuration file names/formats.
Summary: We're using different clang-tidy frontends (command-line, batch analysis jobs, code review integration), some of which are limited in the choice of configuration format. In order to avoid duplication of configuration information, we need to support the same configuration format in the command-line tool. This patch adds an extension point to make this possible without rewriting FileOptionsProvider.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 220199
2014-10-20 12:29:15 +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 1efc425551 [clang-tidy] Default options in modules.
Summary:
This patch allows modules to specify default options for the checks
defined in them. This way a sufficiently configurable check can be registered in
multiple modules with different default options. E.g. the SpacesBeforeComments
option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the
"google-readability-namespace-comment" check without modifying or extending the
check code.

This patch also registers the google-readability-braces-around-statements check
with suitable defaults.

Reviewers: djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 219923
2014-10-16 11:27:57 +00:00
Alexey Samsonov d1127d2d1f Avoid having "using namespace" for both "clang" and "llvm" namespaces.
This is fragile, as there are classes with the same name in both
namespaces (e.g. llvm::Module and clang::Module).

llvm-svn: 219855
2014-10-15 22:00:40 +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
Alexander Kornienko f305000a91 [clang-tidy] misc-braces-around-statements.ShortStatementLines option
Add option ShortStatementLines to trigger this check only if the statement spans
over at least a given number of lines.

Modifications from the original patch:
  merged test/clang-tidy/misc-braces-around-statements-always.cpp into
  test/clang-tidy/misc-braces-around-statements.cpp and removed unnecessary
  CHECK-NOTs from the tests.

http://reviews.llvm.org/D5642

Patch by Marek Kurdej!

llvm-svn: 219611
2014-10-13 12:46:22 +00:00
Manuel Klimek 3f840a934e Re-structure clang-rename into a library and the tool.
This allows the unit tests to link the library.

Patch by Xin Huang.

llvm-svn: 219609
2014-10-13 11:30:27 +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 2f03c8a38d [clang-tidy] Allow space between "TODO" and "(user)"
llvm-svn: 219091
2014-10-05 23:40:30 +00:00
Benjamin Kramer d12555795e [clang-modernize] Update for API change.
NFC.

llvm-svn: 219063
2014-10-04 17:19:03 +00:00
Alexander Kornienko 44fe05beeb [clang-tidy] Documented check testing.
llvm-svn: 218962
2014-10-03 07:08:22 +00:00
Craig Topper e95cd8d5b8 Add missing 'override' keyword.
llvm-svn: 218961
2014-10-03 06:34:41 +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
Alexander Kornienko 97e8c3f6b5 [clang-tidy] Clarify a comment.
No functional changes.

llvm-svn: 218772
2014-10-01 15:50:31 +00:00
Alexander Kornienko 5091372331 [clang-tidy] Handle c-style casts from/to enums.
Summary: Convert c-style casts between integral end enum types to static_cast<>.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 218760
2014-10-01 12:47:53 +00:00
Alexander Kornienko 04e9d9ce64 [clang-tidy] Updated documentation
Added an example of check-specific options.

llvm-svn: 218573
2014-09-27 21:47:01 +00:00
Alexander Kornienko 9d32634c61 [clang-tidy] Fix documentation.
Try using code-block: console for command-line usage examples.

llvm-svn: 218572
2014-09-27 21:33:33 +00:00
Alexander Kornienko 55d6274de1 [clang-tidy] Fix for the documentation.
llvm-svn: 218571
2014-09-27 21:27:05 +00:00
Alexander Kornienko e088a46a83 [clang-tidy] Updated documentation.
llvm-svn: 218570
2014-09-27 21:25:26 +00:00
Alexander Kornienko 88905b3909 Corrected a comment in check_clang_tidy_fix.sh
llvm-svn: 218516
2014-09-26 12:51:13 +00:00
Alexander Kornienko 761c25bc15 [clang-tidy] Test username substitution in TODO() check.
Summary:
This patch depends on D5501.
Check user name substitution more specifically by specifying it via the new
-config= option.
This also lets clang-tidy tests specify clang-tidy options before the '--'
when using check_clang_tidy_fix.sh.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 218515
2014-09-26 12:44:30 +00:00
Alexander Kornienko 7165e89892 Fix a typo
llvm-svn: 218512
2014-09-26 11:48:53 +00:00
Alexander Kornienko eff4e9232a [clang-tidy] Add a -config={YAML} option.
Summary:
Add -config option to allow specifying configuration in YAML/JSON
format on the command line.

Reviewers: klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 218511
2014-09-26 11:42:29 +00:00
Alexander Kornienko f5a57c9c24 Clang-tidy google-readability-function check: don't warn on gmock
testing::Unused parameters.

Reviewers: bkramer, klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 218443
2014-09-25 08:16:24 +00:00
Alexander Kornienko e995154ac2 Provide user name in ClangTidyOptions.
Summary:
This adds the ClangTidyOptions::User field and fills it from the USER
or the USERNAME environment variable, if possible. The FileOptionsProvider now
takes "default" options instead of "fallback" options, as it now uses these when
an option is not set in the configuration file (one exception is the checks
list).

Reviewers: bkramer, klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 218402
2014-09-24 18:36:03 +00:00
Benjamin Kramer 39e40cccc6 Drop superfluous semicolon. GCC's -pedantic warns about this.
llvm-svn: 218310
2014-09-23 14:46:55 +00:00
NAKAMURA Takumi 9e0d592838 ClangTidyTests: Add dependency on clangTidyUtils.
I missed to add it since I suppressed checks on win32 in r215590.

llvm-svn: 218289
2014-09-23 00:53:38 +00:00
Benjamin Kramer d15514a8bd Try to pacify dash-using linux distros with a very old-school shell variable compare.
While there fix the cmake shared build.

llvm-svn: 218274
2014-09-22 21:01:04 +00:00
Alexander Kornienko 451567ac43 Add missing dependency.
llvm-svn: 218249
2014-09-22 14:56:43 +00:00
Alexander Kornienko 33fc3db9a1 Add NamespaceCommentCheck to the Google module.
Summary:
This uses a bit hacky way to set the defaults for the spaces before
comments, but it's also one of the simplest ways. Fixed a bug with how the
SpacesBeforeComments option was used.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 218240
2014-09-22 10:41:39 +00:00
NAKAMURA Takumi 52002ee5bb ClangRenameTests: Prune redundant libdeps.
llvm-svn: 218235
2014-09-22 05:45:11 +00:00
NAKAMURA Takumi 44a3731281 Add newline at eof.
llvm-svn: 218234
2014-09-22 05:45:01 +00:00
Alexander Kornienko f73fe3a04e run-clang-tidy.py: don't fail when running without -checks=.
llvm-svn: 218227
2014-09-22 00:07:07 +00:00
Alexander Kornienko 02bd018aeb Disable most of the google-readability-casting check for non-C++ files (only
leave the "redundant cast to the same type" part).

llvm-svn: 218225
2014-09-21 23:39:28 +00:00
Hans Wennborg dfd8c74a98 [clang-tidy] Don't leak the TodoCommentHandler object
Preprocessor:addCommentHandler() does not take ownership,
so we'd end up leaking the TodoCommentHandler.

This patch makes it owned by the Check object.

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

llvm-svn: 218068
2014-09-18 18:59:50 +00:00
Benjamin Kramer 6be414da26 [clang-tidy] Add a checker that warns on TODO comments without username.
It also suggests a fix-it, taking the name from $USER. This will be made
configurable eventually.

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

llvm-svn: 218049
2014-09-18 12:53:13 +00:00
Benjamin Kramer ebdf90ca00 Make a variable local so it's lifetime becomes more obvious.
NFC

llvm-svn: 217952
2014-09-17 13:12:51 +00:00
Benjamin Kramer ae8fc52237 [clang-tidy] Don't emit the same fixit multiple times.
If we had many header files we would attach the fix-it for all files to all
warnings, oops. This is harmless 99.9% of the time but can confuse the rewriter
in some edge cases. Sadly I failed to create a small test case for this.

While there move fix-its instead of copying.

llvm-svn: 217951
2014-09-17 11:48:34 +00:00